Constructs a new type from T by picking K from the non-null and non-undefined type of T and preserves null and undefined as union types if they were part of the original union.
T
K
null
undefined
type User = { id: string; name: string;}type Post = { title: string; body: string; author: User | null;}NullablePick<Post["author"], "id">; // Pick<User, "id"> | null Copy
type User = { id: string; name: string;}type Post = { title: string; body: string; author: User | null;}NullablePick<Post["author"], "id">; // Pick<User, "id"> | null
Constructs a new type from
Tby pickingKfrom the non-null and non-undefined type ofTand preservesnullandundefinedas union types if they were part of the original union.