TypeScript · Generics and utility types
Pick<T, K> / Omit<T, K>
Builds a new object type from selected or excluded keys.
Syntax
Pick<User, "id">Example
Example
type User = { id: string; name: string; password: string };
type PublicUser = Omit<User, "password">;
type Id = Pick<User, "id">;More in this group
Learn this in the course
Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.