Extract is another utility type that is available in TypeScript. It allows us to extract a member from a type and create a new type.
Example
type Vehicles =
| { make: 'BMW', model: '325', type: 'sedan' }
| { make: 'BMW', model: '525', type: 'sedan' }
| { make: 'BMW', model: 'X6', type: 'SUV' };
type SUV = Extract<Vehicles, {type: 'SUV'}>
If we put the mouse pointer over the type SUV, we would get the following:
{
make: 'BMW',
model: 'X6',
type: 'SUV'
}