Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 556 Bytes

File metadata and controls

26 lines (17 loc) · 556 Bytes

Home > types-kit > IfExtends

IfExtends type

If Condition[0] extends Condition[1], return Case1, else return Case2.

Signature:

export type IfExtends<Condition extends [unknown, unknown], Case1, Case2> = [
  Condition[0],
] extends [Condition[1]]
  ? Case1
  : Case2

Example

 // Expect: 1
 type Foo = IfExtends<[true, boolean], 1, 2>