/** * Partial 泛型深度化 * @example * type Person = { * name: string * address: { * country: string * } * } * type PersonPartial = DeepPartial; * // { * // name?: Deep; * // address?: Deep<{ * // country: string; * // } | undefined>; * // } */ type DeepPartial = { [P in keyof T]?: T[P] extends (infer U)[] ? DeepPartial[] : T[P] extends ReadonlyArray ? ReadonlyArray> : DeepPartial; }; export default DeepPartial;