Pick<T, K>
Last updated: 2026-10-22
Pick<T, K> Pick
Pick<T, K> plucks the properties named by K out of T into a new type. When you only need a slice of a big type (list summaries, subset parameters), there is no need to hand-write a duplicate — and if the source field types change, the Picked type follows automatically.
| Group | Utility Types |
|---|---|
| Kind | Type |
| Strict mode | Not required |
ℹ️ Info The editor transpiles TypeScript to JavaScript and runs it (no type checking); see each example's Output for type-check results.
📝 Syntax
type Pick<T, K extends keyof T> = {
[P in K]: T[P];
};
// Usage
type OrderSummary = Pick<Order, "id" | "buyer" | "total">;
⚙️ Parameters
| T | The source object type whose properties are selected |
|---|---|
| K extends keyof T | The union of keys to keep; must be existing keys of T — a misspelled key is a compile error (Pick's safety net) |
Returns:A new type containing only the properties named by K, with the same types as in T.
▶ Example
Edit the code below and click Try it to see the transpiled result:
Output:
{"id":"A-1024","buyer":"Carol","total":259}
(Runtime output after transpilation; accessing order.address on an OrderSummary is a compile error — fields outside the Pick whitelist do not exist in the type)
💡 Notes
ℹ️ Info Implementation: type Pick<T, K extends keyof T> = { [P in K]: T[P] } — K is a key union and the mapped type pulls each property type in turn.
⚠️ Note Pick is a whitelist: fields added to Order later will not appear in the Picked type. If your intent is "everything except a few", use Omit (blacklist) instead — otherwise new fields silently drop out.
💡 Tip Rule of thumb: few fields wanted → Pick; few fields to drop → Omit. Both are shallow type-level selections — nested objects remain shared references.
🏷️ Related Utility Types
💡 Related cases
More cases coming soon.
📚 Related tutorials
❓ FAQ
Q Does mutating a Picked object affect the original?
A Pick selects properties at the type level only; it copies no data. Runtime sharing depends on your code (the example's toSummary builds a fresh object via destructuring); if you pass the same object reference, mutations are of course visible to both.
Q What happens if I pick a key that does not exist?
A Compile error: Type '"oderId"' is not assignable to type 'keyof Order'. K is constrained to keyof T, so typos surface immediately — which makes Pick safer than Omit (which performs no such check).
Q Can Pick include methods too?
A Yes. Methods are properties, so Pick<T, "save"> yields a type like { save: () => void } with the same this-binding expectations as the original.