On this page
Exclude
Prev: union_and_nullability | Up: union_and_nullability | Next: `Extract`
Rel: union_and_nullability, Conditional & Mapped Types
Ref: TypeScript Docs — Utility Types
Tags: #public #web #typescript #utility-types #union_and_nullability #tier/core
Syntax & Overview
Exclude<UnionType, ExcludedMembers>
Removes union members assignable to ExcludedMembers.
Notes & Pitfalls
- Subtracts union members assignable to
U: Operates on unions (useOmitfor object properties).
Example
type Method = "GET" | "POST" | "DELETE";
type SafeMethod = Exclude<Method, "DELETE">; // "GET" | "POST"
Linked from
Related notes
- tuts/typescript/utility_types/union_and_nullability/Extract Linked here; links to this page; shared tags: #tier, #typescript, #web
- tuts/typescript/utility_types/union_and_nullability Linked here; links to this page; shared tags: #typescript, #web
- tuts/typescript/type_system/conditional_and_mapped_types Linked here; shared tags: #typescript, #web
- tuts/typescript/builtins/any shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/as_const shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/asserts shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/enum shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/infer shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/is shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/keyof shared tags: #tier, #typescript, #web