Deviopath › TypeScript

Pick Properties

Medium · Utility Types

Write pick<T, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> that returns a new object with only the listed keys.

Pick<T, K> is the built-in utility type for "T, but only the properties K".

Next: Omit Properties