Conditional types let us express type transformations that differ depending on a condition. Conditional types aren’t very useful on their own but are extremely useful in generic types. A common use case is to use a conditional type with the never type to prune values from a type. An approach used heavily within Typescript’s standard utility types.

2m read timeFrom levelup.gitconnected.com
Post cover image
Table of contents
Conditional Types in TypeScriptCreating a custom conditional typeThe extends keyword
6 Impressions