TypeScriptUtility types
Omit<Type, Keys>
Creates a type without selected properties of another type.
Example
#TypeScript
interface Task {
id: number
title: string
done: boolean
createdAt: string
}
type NewTask = Omit<Task, 'id' | 'createdAt'>
let nextId = 1
function createTask(input: NewTask): Task {
return { ...input, id: nextId++, createdAt: '2026-09-28' }
}
console.log(createTask({ title: 'Grid module', done: false }))Result
{ title: 'Grid module', done: false, id: 1, createdAt: '2026-09-28' }Definition and usage
#Omit<Type, Keys> works the opposite way from Pick: it copies every field of the type except the ones given. Omit<User, "passwordHash"> is a user without the password hash.
It’s very often used when creating new objects where the server supplies some of the fields, for example Omit<Task, "id" | "createdAt"> for data coming from a form.
Unlike with Pick, the keys in Omit don’t have to exist on the type, so a typo won’t be reported. It’s worth being careful when renaming fields.
Syntax
#Syntax
type New = Omit<Type, "field1" | "field2">Type parameters
#Type
object type
The source type.Keys
union of keys
The fields to remove.
Good practices
#- A form’s data type is often an
Omitof the server model, without the automatically generated fields. - Combine
Omitwith an intersection to swap the type of one field:Omit<User, "id"> & { id: string }.
Related entries
#- Pick vs OmitPick<Type, Keys> selects only the given fields from a type, while Omit<Type, Keys> copies every field except the given ones.
- Pick<Type, Keys>Creates a type containing only selected properties of another type.
- Partial<Type>Creates a type where every property is optional.
- Exclude<UnionType, ExcludedMembers>Removes from a union the types that match a given type.
Spotted a mistake or missing an example? Write to us.