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

Exclude<UnionType, ExcludedMembers>

Constructs a type by excluding from UnionType all union members that are assignable to ExcludedMembers.

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

Parameters

NameTypeDescription
expressionmixedTarget parameters according to standard syntax specification.

Examples

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