The guide to conditional types in TypeScript
Since version 2.8, TypeScript has introduced support for conditional types. Conditional types let us deterministically define type transformations depending on a condition. In brief, they are a ternary conditional operator applied at the type level rather than at the value level.