Utilities for type-level testing and assertions in TypeScript. These types help compare, validate, and ensure type conditions in testing or advanced development scenarios.
import type { Equals, Expect, Not } from "@halvaradop/ts-utility-types/test"
Equals<X, Y>
Checks if two types are strictly equal.
// Expected: true
type CheckTrue = Equals<true, true>
// Expected: false
type CheckFalse = Equals<() => {}, true>
Expect<T extends true>
Ensures the received type is true
. Useful for type-level tests.
// Expected: true
type CheckTrue = Expect<true>
// Expected: false (type error)
type CheckFalse = Expect<false>
Not<T extends boolean>
Negates a boolean type value.
// Expected: false
type CheckFalse = Not<true>
// Expected: true
type CheckTrue = Not<false>