Type expression

Omit<T, K>

  • Utility types
  • Since TypeScript 3.5

Omit<Product, "id"> has every property of Product except id. It is the natural type for data before the server or the database adds fields: a draft passed to create(), which returns the full Product.

Passing the omitted property in an object literal is TS2353, as the first example shows, so callers cannot set an id that create() will overwrite. TypeScript added Omit in version 3.5.

At a glance

JSDoc in a .js file TypeScript in a .ts file
/** @type {Omit<Product, "id">} */ : Omit<Product, "id">

Examples

products.js products.ts Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: products.js(15,10): error TS2353: Object literal may only specify known properties, and 'id' does not exist in type 'Omit<Product, "id">'. products.ts(11,10): error TS2353: Object literal may only specify known properties, and 'id' does not exist in type 'Omit<Product, "id">'. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. products.js(15,10): error TS2353: Object literal may only specify known properties, and 'id' does not exist in type 'Omit<Product, "id">'. products.ts(11,10): error TS2353: Object literal may only specify known properties, and 'id' does not exist in type 'Omit<Product, "id">'. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. products.js(15,10): error TS2353: Object literal may only specify known properties, and 'id' does not exist in type 'Omit<Product, "id">'. products.ts(11,10): error TS2353: Object literal may only specify known properties, and 'id' does not exist in type 'Omit<Product, "id">'. checked 21 October 2026
/** @typedef {{ id: string, sku: string, price: number }} Product */

let nextId = 1;

/**
 * @param {Omit<Product, "id">} draft
 * @returns {Product}
 */
export function create(draft) {
  return { id: `p_${nextId++}`, ...draft };
}

create({ sku: "TEE-01", price: 19.5 });
create({ id: "p_9", sku: "MUG-07", price: 12 });error TS2353: Object literal may only specify known properties, and 'id' does not exist in type 'Omit<Product, "id">'.
type Product = { id: string; sku: string; price: number };

let nextId = 1;

export function create(draft: Omit<Product, "id">): Product {
  return { id: `p_${nextId++}`, ...draft };
}

create({ sku: "TEE-01", price: 19.5 });
create({ id: "p_9", sku: "MUG-07", price: 12 });error TS2353: Object literal may only specify known properties, and 'id' does not exist in type 'Omit<Product, "id">'.
Omit<T, K> drops properties.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}
products.js TypeScript 5.9.3 TypeScript 5.9.3, run 21 October 2026: No errors. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. No errors. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. No errors. checked 21 October 2026
/** @typedef {{ id: string, sku: string, price: number }} Product */

// No error: Omit accepts any key, so the typo removes nothing.
/** @typedef {Omit<Product, "iid">} Draft */

/** @type {Draft} */
const draft = { id: "p_1", sku: "TEE-01", price: 19.5 };

export { draft };
Omit does not check that the key exists.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}

The keys are not checked

Omit accepts any key, not only keys of the type, so Omit<Product, "iid"> is not an error. It simply removes nothing, as the second example shows. When the key list matters, use Pick with the keys to keep, or a typedef whose key parameter is constrained (@template T, @template {keyof T} K, @typedef {Omit<T, K>} StrictOmit), which rejects a misspelled key with TS2344.

Gotchas

  • Omit on a union does not distribute: Omit<A | B, "id"> keeps only the properties A and B share. Write a conditional type to omit from each member separately.
  • The result is a new object type, so hovers show the expanded property list rather than the original name.

Questions

How do I remove a property from a type in JSDoc?

/** @typedef {Omit<Product, "id" | "createdAt">} ProductDraft */.

Sources

Last reviewed 20 October 2026.