1 | import { AnyArray } from "../any-array";
|
2 | import { Builtin } from "../built-in";
|
3 | import { IsTuple } from "../is-tuple";
|
4 | import { IsUnknown } from "../is-unknown";
|
5 | export type DeepReadonly<Type> = Type extends Exclude<Builtin, Error> ? Type : Type extends Map<infer Keys, infer Values> ? ReadonlyMap<DeepReadonly<Keys>, DeepReadonly<Values>> : Type extends ReadonlyMap<infer Keys, infer Values> ? ReadonlyMap<DeepReadonly<Keys>, DeepReadonly<Values>> : Type extends WeakMap<infer Keys, infer Values> ? WeakMap<DeepReadonly<Keys>, DeepReadonly<Values>> : Type extends Set<infer Values> ? ReadonlySet<DeepReadonly<Values>> : Type extends ReadonlySet<infer Values> ? ReadonlySet<DeepReadonly<Values>> : Type extends WeakSet<infer Values> ? WeakSet<DeepReadonly<Values>> : Type extends Promise<infer Value> ? Promise<DeepReadonly<Value>> : Type extends AnyArray<infer Values> ? Type extends IsTuple<Type> ? {
|
6 | readonly [Key in keyof Type]: DeepReadonly<Type[Key]>;
|
7 | } : ReadonlyArray<DeepReadonly<Values>> : Type extends {} ? {
|
8 | readonly [Key in keyof Type]: DeepReadonly<Type[Key]>;
|
9 | } : IsUnknown<Type> extends true ? unknown : Readonly<Type>;
|