Expect
Generic assertion wrapper that expects a type to betrue.
Type Signature
The type to assert. Must extend
true, otherwise a compile-time error is produced.Purpose
Wraps boolean type expressions and produces a compile-time error if the expression does not evaluate totrue. Commonly used with Equal to test type equality.
Examples
MyPick is implemented incorrectly, TypeScript will report an error on the failing Expect line.
ExpectTrue
Explicitly assert that a type istrue.
Type Signature
The type to assert. Must be exactly
true.Purpose
Functionally identical toExpect, but provides semantic clarity when testing boolean conditions. Use this when the assertion is explicitly about a boolean value being true.
Examples
ExpectFalse
Explicitly assert that a type isfalse.
Type Signature
The type to assert. Must be exactly
false.Purpose
Asserts that a boolean type expression evaluates tofalse. Useful for negative test cases.
Examples
ExpectExtends
Assert that a value type extends an expected type.Type Signature
The actual value type being tested.
The type that VALUE should extend.
Purpose
Tests whetherEXPECTED extends VALUE, returning true or false. This is useful for testing subtype relationships and union type compatibility.
Examples
ExpectValidArgs
Assert that function arguments match the function’s parameter types.Type Signature
The function type whose parameters are being validated.
The argument types to validate against the function’s parameters.
Purpose
Validates that a tuple of argument types matches a function’s parameter types. Returnstrue if the arguments are valid, false otherwise.
Examples
IsTrue
Assert a type istrue.
Type Signature
The type to assert. Must be exactly
true.Purpose
Alias forExpectTrue. Used for semantic clarity in type detection scenarios.
IsFalse
Assert a type isfalse.
Type Signature
The type to assert. Must be exactly
false.Purpose
Alias forExpectFalse. Used for semantic clarity in type detection scenarios.