UNPKG

841 BTypeScriptView Raw
1import { Builtin } from "../built-in";
2import { IsUnknown } from "../is-unknown";
3export type DeepWritable<Type> = Type extends Exclude<Builtin, Error> ? Type : Type extends Map<infer Key, infer Value> ? Map<DeepWritable<Key>, DeepWritable<Value>> : Type extends ReadonlyMap<infer Key, infer Value> ? Map<DeepWritable<Key>, DeepWritable<Value>> : Type extends WeakMap<infer Key, infer Value> ? WeakMap<DeepWritable<Key>, DeepWritable<Value>> : Type extends Set<infer Values> ? Set<DeepWritable<Values>> : Type extends ReadonlySet<infer Values> ? Set<DeepWritable<Values>> : Type extends WeakSet<infer Values> ? WeakSet<DeepWritable<Values>> : Type extends Promise<infer Value> ? Promise<DeepWritable<Value>> : Type extends {} ? {
4 -readonly [Key in keyof Type]: DeepWritable<Type[Key]>;
5} : IsUnknown<Type> extends true ? unknown : Type;