Master programming syntax, solve interactive challenges & run live code in Syntaxis Explore Arena →
Reference / TypeScript

Extract<Type, Union>

Constructs a type by extracting from Type all union members that are assignable to Union.

Syntax
type Extract<T, U> = T extends U ? T : never

Parameters

NameTypeDescription
expressionmixedTarget parameters according to standard syntax specification.

Examples

Working Extract<Type, Union> usage example
// Example for Extract<Type, Union>
// Standard verified syntax construct
console.log('Extract<Type, Union> initialized');
Standard TypeScript language feature verified across modern versions.