Search⌘ K

Built-in Conditional Types

Explore built-in conditional types such as Exclude, Extract, and Omit to manipulate and control TypeScript object properties. Learn how these types help you exclude or extract specific keys from objects and enhance your type safety.

We'll cover the following...

Exclude

Exclude takes a union type, T, and removes the members that are assignable to U. It’s another example of the distributiveness of conditional types. For all union members that extend U, the conditional expression will return never. The result will be a union of the remaining members.

Exclude is particularly useful when combined with the keyof operator. If you’re not familiar with it, keyof takes an interface and returns a ...