assertEqual()function

assertEqual(left: unknown, right: T, caller: AnyCaller = assertEqual): asserts left is T
ParamType
leftunknown
The value to check and narrow. required
rightT
The value left must equal. required
callerAnyCaller
Function to attribute a thrown error to (defaults to assertEqual). Defaults to assertEqual
Return
asserts left is T
Throws
RequiredError
If the values are not equal.

Assert that two values are exactly (referentially) equal, narrowing left to the type of right.

Examples

assertEqual(1, 1); // passes