Examples
const value = getValue()
assert(value, 'A value is required.')
// `value` is narrowed to a non-nullish value after this call.Function
assert<T>(test: T, message: string): test is NonNullable<T>Checks that test is not null or undefined.
All other values, including false, 0, and an empty string, pass this
assertion. A successful call returns undefined; a failed call throws via
throws and never returns.
const value = getValue()
assert(value, 'A value is required.')
// `value` is narrowed to a non-nullish value after this call.