Category: TypeScript
-
Make all properties optional using Partial in TypeScript
The utility type Partial<Type> makes all properties of a type optional. Using a scenario, let us try to understand Partial<T> in TypeScript. So, you have a type called Product, that is created as below: export interface Product { Id: string; Title: string; Price: number; inStock: boolean; Quantity: number; } And there is a function to update the price of a product as shown…