On this page
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
- Strictly checks that every key exists in
T: PreferPickoverOmitwhen selecting a small subset of fields.
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
- tuts/typescript/utility_types/object_transforms/Omit Linked here; links to this page; shared tags: #tier, #typescript, #web
- tuts/typescript/utility_types/object_transforms/Record Linked here; links to this page; shared tags: #tier, #typescript, #web
- tuts/typescript/utility_types/object_transforms Linked here; links to this page; shared tags: #typescript, #web
- tuts/typescript/type_system/conditional_and_mapped_types Linked here; shared tags: #typescript, #web
- tuts/typescript/builtins/any shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/as_const shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/asserts shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/enum shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/infer shared tags: #tier, #typescript, #web
- tuts/typescript/builtins/is shared tags: #tier, #typescript, #web