Create a restricted object shape
Derive a public or update-facing model while excluding internal or immutable fields.
TypeScript · Type Alias
Omit<Type, Keys> creates a new type with all properties from Type except the keys listed in Keys. It is globally available and complements Pick.
Omit constructs a new object type from an existing type by retaining every property except the keys specified in its second type argument. The keys can be a string literal or a union of string literals, making it useful for deriving variants without repeating the original declaration.
Omit<Type, Keys>| Name | Type | Description |
|---|---|---|
Type | type | The object type whose properties form the starting point. |
Keys | string literal or union of string literals | A string literal or union of string literals naming properties to remove. |
A type containing all properties of Type except the properties named by Keys.
type Person = {
name: string;
age: number;
location: string;
};
type PersonWithoutLocation = Omit<Person, "location">;
const person: PersonWithoutLocation = {
name: "Ada",
age: 36,
};The resulting type keeps name and age while excluding location.
Derive a public or update-facing model while excluding internal or immutable fields.
Build related variants without duplicating a base interface or type alias.
Remove multiple fields by passing a union of property-name literals.
Omit<Type, Keys> creates a type containing all properties from Type except those listed by Keys. Keys may be one string literal or a union of string literals.
Follow-up: How does it relate to Pick? Pick keeps only selected properties, while Omit removes selected properties from the complete property set.
Omit is a globally available TypeScript utility type. It is useful when a derived type should preserve the source shape except for a small block-listed set of properties.
Follow-up: What is a common alternative when the desired result is an allow-list? Use Pick with the properties that should remain.
The utility was released in TypeScript 3.5. Its declaration is generic: the first parameter supplies the source type and the second supplies the keys to remove.
Follow-up: What happens if several keys must be excluded? Pass a union of string literal keys as the second argument.
PickPartialRequiredReadonlyExclude