On this page
  1. Pick
  2. Syntax & Overview
  3. Notes & Pitfalls
  4. Example

Pick

Prev: `Record` | Up: object_transforms | Next: `Omit`
Rel: object_transforms, Conditional & Mapped Types
Ref: TypeScript Docs — Utility Types
Tags: #public #web #typescript #utility-types #object_transforms #tier/core


Syntax & Overview

Pick<T, Keys>

Constructs a type keeping only the specified subset of properties Keys from T.

Notes & Pitfalls

Example

interface Article { id: string; title: string; body: string; author: string }
type ArticleCard = Pick<Article, "id" | "title">;

const card: ArticleCard = { id: "1", title: "TypeScript Utility Types" };

Linked from

Related notes