TypeScript utility types: omit and pick

As is in the name, at the heart of everything TypeScript offers, are types. As you pass around data, having a predictable structure helps not only reduce run-time errors but also improves developer productivity as you have IntelliSense support in your favourite IDE.
However, sometimes you only want a subset of data from a larger object, which is where TypeScript's utility types come in:
OmitPick
These let you create new types based on an existing type, but filtering in/out specific properties:
type User = {
username: string;
firstName: string;
lastName: string;
emailAddress: string;
avatarUrl: string;
address: {
addressLine1: string;
addressLine2: string;
};
createdAt: Date;
}
// Provides only username and avatarUrl properties
type MessageBoardUser = Pick<User, "username" | "avatarUrl">
// Provides firstName, lastName, emailAddress and address properties
type ShippingUser = Omit<User, "username" | "avatarUrl" | "createdAt">




