Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 520 Bytes

types-kit.if.md

File metadata and controls

27 lines (18 loc) · 520 Bytes

Home > types-kit > If

If type

If for types.

Signature:

export type If<Condition, Case1, Case2> = IfExtends<
  [IsTruthy<Condition>, true],
  Case1,
  Case2
>

References: IfExtends, IsTruthy

Example

 // Expect: 1
 type Foo = If<true, 1, 2>