Type Alias IsNotEqual<A, B, Then, Else>

IsNotEqual<A, B, Then, Else>: IsEqual<A, B, Else, Then>

Checks A and B are not equal.

type R = IsNotEqual<1, 1> // false
type R = IsNotEqual<any, any> // false
type R = IsNotEqual<boolean, boolean> // false
type R = IsNotEqual<true, true> // false
type R = IsNotEqual<[1], [1]> // false

type R = IsNotEqual<boolean, true> // true
type R = IsNotEqual<any, 1> // true
type R = IsNotEqual<[any], [1]> // true
type R = IsNotEqual<{ a: 1 }, { a: 1; b: 2 }> // true

Note that intersection type checks only works at first level. It cannot be check recursively, or else will run into infinite recursion if the type includes recursive types.

Type Parameters

  • A
  • B
  • Then = true
  • Else = false