TypeScriptUtility types

Omit<Type, Keys>

Creates a type without selected properties of another type.

On this page

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 Omit of the server model, without the automatically generated fields.
  • Combine Omit with an intersection to swap the type of one field: Omit<User, "id"> & { id: string }.

Related entries

#

Spotted a mistake or missing an example? Write to us.