Pick Utility Type
What
The Pick<T, K> utility type allows you to create a new type by selecting only specific properties (K) from an existing type (T).
How
You provide the original type and a union of the keys you want to include:
interface Product {
id: string;
name: string;
price: number;
description: string;
}
// Only id and name are included
type ProductPreview = Pick<Product, "id" | "name">;
Why
Pick follows the “single source of truth” principle by allowing you to derive “slim” versions of a type for specific use cases (like a search result list or a summary view) without having to manually redefine those properties.
Summary
Use Pick<T, K> to extract exactly the properties you need from a larger, more complex type.