On this page
  1. Exclude
  2. Syntax & Overview
  3. Notes & Pitfalls
  4. Example

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

Example

type Method = "GET" | "POST" | "DELETE";
type SafeMethod = Exclude<Method, "DELETE">; // "GET" | "POST"

Linked from

Related notes