/** * @description Combines members of an intersection into a readable type. * * @link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg * @example * Prettify<{ a: string } | { b: string } | { c: number, d: bigint }> * => { a: string, b: string, c: number, d: bigint } */ export type Prettify = { [K in keyof T]: T[K]; } & {}; /** * @description Creates a type with all keys K from T as non-null. */ export type NonNull = { [P in keyof T]-?: NonNullable; }; export type PonderTypeError = error; export type DeepPartial = { [P in keyof T]?: T[P] extends (infer U)[] ? DeepPartial[] : T[P] extends object ? DeepPartial : T[P]; }; /** * @description Creates a partial type with the selected keys required. * * @example * type t = PartialExcept<{ a: string, b: boolean }, "a"> * // ^? t: { a: string, b?: boolean } */ export type PartialExcept = { [P in K]: T[P]; } & { [P in keyof Omit]?: T[P]; }; /** * @description Marks a property of an object as optional. */ export type MakeOptional = Omit & Partial>;