Skip to content

assertcheck v1.0.0


assertcheck / assert / array

Function: array()

ts
function array<T>(v, opts?): asserts v is T[];

Defined in: src/assert.ts:307

Asserts that v is an array. Narrows the type to T[] after the call.

Type Parameters

Type ParameterDefault typeDescription
TunknownThe expected element type (defaults to unknown).

Parameters

ParameterType
vunknown
opts?Opts

Returns

asserts v is T[]

Example

ts
`assert.array<User>(users, "users must be an array")`

Released under the Apache 2.0 License. Built by Vagabond Studio — senior-only for growing companies.