Skip to content

assertcheck v1.0.0


assertcheck / assert / object

Function: object()

ts
function object<T>(v, opts?): asserts v is T;

Defined in: src/assert.ts:337

Asserts that v is a plain object (not a class instance, not an array). Narrows the type to T after the call.

Type Parameters

Type ParameterDefault typeDescription
T extends objectobjectThe expected object type (defaults to object).

Parameters

ParameterType
vunknown
opts?Opts

Returns

asserts v is T

Example

ts
`assert.object<Config>(raw, "raw must be a plain object")`

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