Skip to main content

@midnight-ntwrk/midnight-js-utils v0.2.5 • API


Midnight.js API Reference v0.2.5 / @midnight-ntwrk/midnight-js-utils / assertDefined

Function: assertDefined()

assertDefined<A>(value, message?): asserts value is NonNullable<A>

Asserts that the given value is non-nullable.

Type parameters

A

Parameters

value: undefined | null | A

The value to test for nullability.

message?: string

The error message to use if an error is thrown.

Returns

asserts value is NonNullable<A>

Throws

Error If the value is nullable.