Asserts that the input is a boolean.
An error if the input is not a boolean.
const fn = (x: unknown) => { assertIsBoolean(x); return x; // x has inferred type boolean}; Copy
const fn = (x: unknown) => { assertIsBoolean(x); return x; // x has inferred type boolean};
The input to be asserted.
Asserts that the input is a boolean.
Throws
An error if the input is not a boolean.
Example