* Credit: https://github.com/typeorm/typeorm/blob/master/src/common/DeepPartial.ts
* A utility type that recursively makes all properties of a type optional, including nested objects.
* Unlike TypeScript's built-in `Partial<T>` which only makes top-level properties optional,
* `DeepPartial<T>` recursively applies the `Partial` transformation to all nested objects,
* arrays, Maps, and Sets within the type structure.
* @template T - The type to make deeply partial
* type PartialUser = DeepPartial<User>;
* const partialConfig: DeepPartial<Config> = {
* baseUrl: "https://api.example.com"
* // features is optional
* - Objects: Recursively makes all properties optional
* - Arrays: Makes array elements deeply partial
* - Maps: Makes both keys and values deeply partial
* - Sets: Makes set elements deeply partial
* - Primitives: Returns as-is
export type DeepPartial<T> =
| (T extends Array<infer U>
: T extends Map<infer K, infer V>
? Map<DeepPartial<K>, DeepPartial<V>>
? { [K in keyof T]?: DeepPartial<T[K]> }