import { Builtin } from "../built-in"; import { IsTuple } from "../is-tuple"; export type DeepNullable = Type extends Builtin ? Type | null : Type extends Map ? Map, DeepNullable> : Type extends ReadonlyMap ? ReadonlyMap, DeepNullable> : Type extends WeakMap ? DeepNullable extends object ? WeakMap, DeepNullable> : never : Type extends Set ? Set> : Type extends ReadonlySet ? ReadonlySet> : Type extends WeakSet ? DeepNullable extends object ? WeakSet> : never : Type extends ReadonlyArray ? Type extends IsTuple ? { [Key in keyof Type]: DeepNullable | null; } : Type extends Array ? Array> : ReadonlyArray> : Type extends Promise ? Promise> : Type extends {} ? { [Key in keyof Type]: DeepNullable; } : Type | null;