TypeScript Omit utility type
Omit<T, O>
takes in an object type T
and a string or string union O
to define keys to remove from T
.
tsx
type Cart = {
items: Item[];
total: number;
startedAt: Date;
}
// CartSnapshot = { items: Item[] };
type CartSnapshot = Omit<Cart, "total" | "startedAt">;