Skip to main content

assert

Verifies if the supplied value is defined. If not, an error is thrown.

Signature

assert<T>(input: T | undefined, error?: string): T

Parameters

NameTypeOptionalDescription
inputTNoSpecifies the value to assert.
errorstringYesSpecifies the optional error message that is thrown.

Return value

Returns the value.