Type Alias DeepReadonly<T>

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

A type where all properties are recursively set to readonly

Type Parameters

  • T