Skip to content

assertcheck v1.0.0


assertcheck / assert / string

Function: string()

ts
function string(v, opts?): asserts v is string;

Defined in: src/assert.ts:188

Asserts that v is a string. Narrows the type after the call.

Parameters

ParameterType
vunknown
opts?Opts

Returns

asserts v is string

Example

ts
`assert.string(name, "name must be a string")`

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