Makes all properties in T optional except for those in K
This utility type is useful when you want to create a variant of an interface where most properties are optional, but specific properties remain required. Commonly used for update operations where only certain fields must be provided.
interface User { id: string; name: string; email: string; age: number;}// Only 'id' is required, all other properties are optionaltype UserUpdate = PartialExcept<User, 'id'>;const update: UserUpdate = { id: '123', // Required name: 'John' // Optional // email and age are also optional}; Copy
interface User { id: string; name: string; email: string; age: number;}// Only 'id' is required, all other properties are optionaltype UserUpdate = PartialExcept<User, 'id'>;const update: UserUpdate = { id: '123', // Required name: 'John' // Optional // email and age are also optional};
Makes all properties in T optional except for those in K