Recursively make all properties readonly.
Object type to transform
Applies readonly modifiers deeply at all nesting levels.
readonly
Function types and special types like Date are preserved unchanged.
type User = { id: number; profile: { name: string; address: { city: string } } };type Readonly = DeepReadonly< User >;// { readonly id: number; readonly profile: {// readonly name: string; readonly address: { readonly city: string }// } } Copy
type User = { id: number; profile: { name: string; address: { city: string } } };type Readonly = DeepReadonly< User >;// { readonly id: number; readonly profile: {// readonly name: string; readonly address: { readonly city: string }// } }
Recursively make all properties readonly.