The first type to compare.
The second type to compare.
type T1 = TypeEq<string, string>; // true
type T2 = TypeEq<string, number>; // false
type T3 = TypeEq<{ a: number }, { a: number }>; // true
type T4 = TypeEq<{ a: number }, { b: number }>; // false
type T5 = TypeEq<any, string>; // false (usually, depends on TS version specifics)
type T6 = TypeEq<never, never>; // true
type T7 = TypeEq<string | number, number | string>; // true
Checks if two types
AandBare exactly the same.This utility uses a technique involving conditional types within function types to determine type equality. It returns the boolean literal
trueifAandBare identical types, andfalseotherwise.