An error with message 'Expected a non-nullable value' if the value is not null or undefined.
Example
constfn = (x?: number | null) => { assertIsNullable(x); // throws an error if x is not null or undefined returnx; // x has inferred type null | undefined };
assertIsNullable(x): asserts x is undefined | null
Asserts that a value is either null or undefined.
Throws
An error with message 'Expected a non-nullable value' if the value is not null or undefined.
Example