Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

Part 6.1Utility types

Utility types derive a new type from an existing one, helping a project keep one source of truth for a model.

Transforming types

TypeScript
interface User { id: number; name: string; email: string; }

type UserUpdate = Partial<Omit<User, "id">>;
type UserPreview = Pick<User, "id" | "name">;

Partial makes properties optional, Pick selects properties and Omit removes them. Use them to express a real relationship, rather than as a shortcut around designing an API.

Feedback 👍
Comments are sent via email to me.