Type expression

Pick<T, K>

  • Utility types
  • Tested with TypeScript 5.9

Pick<Product, "sku" | "name" | "price"> is a type with just those three properties, typed as in Product. It names a smaller view of a larger type, such as what a product card shows, so the view changes when the source does.

The keys are checked: Pick<Product, "sku" | "colr"> is TS2344 ("Type … does not satisfy the constraint 'keyof Product'"), reported on the @typedef line. TypeScript has had Pick since version 2.1.

At a glance

JSDoc in a .js file TypeScript in a .ts file
/** @type {Pick<Product, "sku" | "name">} */ : Pick<Product, "sku" | "name">

Examples

products.js products.ts 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 {{ sku: string, name: string, price: number, description: string }} Product */
/** @typedef {Pick<Product, "sku" | "name" | "price">} ProductCard */

/**
 * @param {Product} product
 * @returns {ProductCard}
 */
export function toCard({ sku, name, price }) {
  return { sku, name, price };
}

/** @param {ProductCard} card */
export function render(card) {
  return `${card.name}: $${card.price}`;
}
type Product = { sku: string; name: string; price: number; description: string };
type ProductCard = Pick<Product, "sku" | "name" | "price">;

export function toCard({ sku, name, price }: Product): ProductCard {
  return { sku, name, price };
}

export function render(card: ProductCard) {
  return `${card.name}: $${card.price}`;
}
Pick<T, K> keeps only some properties.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}
products.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: products.js(4,29): error TS2344: Type '"sku" | "colr"' does not satisfy the constraint 'keyof Product'. Type '"colr"' is not assignable to type 'keyof Product'. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. products.js(4,29): error TS2344: Type '"sku" | "colr"' does not satisfy the constraint 'keyof Product'. Type '"colr"' is not assignable to type 'keyof Product'. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. products.js(4,29): error TS2344: Type '"colr" | "sku"' does not satisfy the constraint 'keyof Product'. Type '"colr"' is not assignable to type 'keyof Product'. checked 21 October 2026
/** @typedef {{ sku: string, name: string, price: number }} Product */

/** @typedef {Pick<Product, "sku" | "colr">} Swatch */error TS2344: Type '"sku" | "colr"' does not satisfy the constraint 'keyof Product'.
  Type '"colr"' is not assignable to type 'keyof Product'.

/** @param {Swatch} swatch */
export function show(swatch) {
  return swatch.sku;
}
Pick checks that the keys exist.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}

Pick or Omit?

Pick names what to keep; Omit names what to drop. Use Pick when the view is small and stable, Omit when you want everything except a few fields. Unlike Pick, Omit does not check its keys.

Gotchas

  • Assigning a full Product to a Pick type is fine; only object literals are checked for extra properties.
  • A picked property keeps its optional and readonly modifiers.

Questions

How do I make a type with only some properties of another in JSDoc?

/** @typedef {Pick<Product, "sku" | "name">} ProductCard */.

Sources

Last reviewed 20 October 2026.