assertType
Generic types: | T |
Fake assert to tell TypeScript that the value is of type T and you are very sure about it. Also checks if the value is null or undefined and throws an error if it is.
Presentation
function assertType (value: unknown, errorMessage?: string | undefined): void;
Returns
void
Parameters
Name | Type | Description |
---|---|---|
value | unknown | |
errorMessage | string | undefined |