TypeScript 7 · Utility types and narrowing

Pick or omit properties

Create a type from a subset of another type's properties.

type UserSummary = Pick<User, "id" | "name">;
type NewUser = Omit<User, "id">;

Official TypeScript 7 documentation

More utility types and narrowing commands

All utility types and narrowing commands · TypeScript 7 cheatsheet

Was this page helpful?