/** * Helper type that takes an input Record type and produces a copy where all properties are optional and nullable, * recursively. * * Useful for declaring the type of unsafe input JSON to ensure that proper null checking is handled. */ export type DeepPartialNullable = { [K in keyof T]?: (T[K] extends object ? DeepPartialNullable : T[K]) | null; }; /** * Implementation of DeepPartial that handles children that may be optional or nullable. */ export type DeepPartialOptional = { [K in keyof T]?: T[K] extends object ? DeepPartialOptional : T[K] extends object | null ? DeepPartialOptional | null : T[K] extends object | undefined ? DeepPartialOptional | undefined : T[K] extends object | null | undefined ? DeepPartialOptional | null | undefined : T[K]; };