TypeScript Utility Types Complete Guide
Typescript Utility types Utility types are helpers that typescript provides to make common type transformations easier. For example if you have a Todo type type Todo = { readonly id: number; title:...

Source: DEV Community
Typescript Utility types Utility types are helpers that typescript provides to make common type transformations easier. For example if you have a Todo type type Todo = { readonly id: number; title: string; description?: string; category?: string; status: "done" | "in-progress" | "todo"; readonly createdAtTimestamp: number; updatedAtTimestamp: number | null; }; And you want to create a TodoPreview type that only has title, status properties. Instead of creating a new type by hardcoding it, you can use type TodoPreview = Pick<Todo, "title" | "status">; // type TodoPreview = { title: string; status: TaskStatus } You might think "So why don't I just hardcode it?" While hardcoding might work for small projects, it quickly becomes a Maintenance Nightmare in professional environments for two main reasons: Intent & Readability: As in larger types you have to manually compare the two types to figure out how they are related while Utility types make the relationship clear Scalability: