devtypes
    Preparing search index...

    Type Alias DeepMutable<T>

    DeepMutable: T extends Function
        ? T
        : T extends (infer U)[]
            ? DeepMutable<U>[]
            : T extends object ? { -readonly [K in keyof T]-?: DeepMutable<T[K]> } : T

    Deep mutable (remove readonly and optional recursively)

    Type Parameters

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