devtypes - v2.0.0
    Preparing search index...

    Type Alias DeepMutable<T>

    DeepMutable: T extends Function
    | Date
        ? T
        : T extends (infer U)[]
            ? DeepMutable<U>[]
            : T extends ReadonlyArray<infer U>
                ? DeepMutable<U>[]
                : T extends Map<infer K, infer V>
                    ? Map<K, DeepMutable<V>>
                    : T extends ReadonlyMap<infer K, infer V>
                        ? Map<K, DeepMutable<V>>
                        : T extends Set<infer U>
                            ? Set<DeepMutable<U>>
                            : T extends ReadonlySet<infer U>
                                ? Set<DeepMutable<U>>
                                : T extends PlainObject
                                    ? { -readonly [K in keyof T]-?: DeepMutable<(...)[(...)]> }
                                    : T

    Recursively remove readonly and optional modifiers.

    Type Parameters

    • T

      Readonly object type to transform

    Produces a fully mutable and required version of a deeply readonly type.

    Will keep functions and special types like Date unchanged.

    type User = { readonly id?: number; profile?: {
    readonly name?: string; address?: { readonly city?: string }
    } };
    type Mutable = DeepMutable< User >;
    // { id: number; profile: { name: string; address: { city: string } } }