@nevware21/ts-utils
    Preparing search index...

    Type Alias DeepReadonly<T>

    DeepReadonly: T extends Function
        ? T
        : T extends ReadonlyArray<infer U>
            ? ReadonlyArray<DeepReadonly<U>>
            : T extends object ? { readonly [P in keyof T]: DeepReadonly<T[P]> } : T

    Represents a recursive readonly type where all nested properties are readonly.

    Type Parameters

    • T

      The type to transform.

    0.14.0

    interface Config {
    server: {
    host: string;
    port: number;
    };
    }

    const cfg: DeepReadonly<Config> = { server: { host: "localhost", port: 8080 } };

    // cfg.server.host = "example.com"; // Error: cannot assign to a read-only property