object-transforms
Omit<T, K>
Constructs a type by removing the properties in K from T. Unlike Pick, its K is not constrained to keyof T, so extra keys are silently ignored.
type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>> Usage patterns
| Pattern | Purpose |
|---|---|
| Omit<T, 'password'> | Strip sensitive or internal fields |
| Omit<T, keyof U> | Remove keys that belong to another type |
| Omit<Props, 'ref'> | Common React pattern for wrapper components |
| Omit<T, never> | Identity — returns T unchanged |
Examples
interface User { id: number; name: string; password: string }
type SafeUser = Omit<User, 'password'>; Result: { id: number; name: string }
type ExtendedProps<P> = Omit<P, 'className'> & { className: string }; Overrides a property by omitting then re-declaring it
type A = Omit<{ a: 1; b: 2 }, 'c'>; A is { a: 1; b: 2 } — non-existent keys are allowed without error
type Complement<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; Definition of Omit expressed directly with Pick + Exclude
Gotcha
Omit does not error on keys missing from T, so typos silently do nothing — prefer `a StrictOmit helper (`type StrictOmit
Related utility types
Pick<T, K>
Builds a new type containing only the properties from T whose keys are in the union K. Ideal for narrowing large interfaces to the subset a function or component actually needs.
Exclude<T, U>
Filters a union T by removing every member that is assignable to U. Distributes over union members via the conditional type, producing the set-difference T \ U.
Partial<T>
Constructs a type where every property of T is set to optional. Useful for representing update payloads, patch objects, and configuration overrides where all fields may be omitted.
Record<K, V>
Creates an object type whose keys come from the union K and whose values all have type V. Useful for lookup tables, dictionaries, and enum-keyed maps.
Required<T>
Removes optionality from every property of T, producing a type where all fields must be present. The -? mapping modifier strips the ? flag from every key.
← All TS utility types · TypeScript vs JavaScript · any vs unknown vs never