type WithOptionalProperties = { [P in keyof T]-?: undefined extends T[P] ? P : never; }[keyof T]; export type MakeOptional = { [P in WithOptionalProperties]?: T[P]; } & { [P in Exclude>]: T[P]; }; export {};