DeepReadonly
HardImplement DeepReadonly<T> which makes all properties (including nested) readonly. Use generics and conditional types.
TypeScript•UTF-8
Run your code to see results.
Click the Run button above
DeepReadonly
HardImplement DeepReadonly<T> which makes all properties (including nested) readonly. Use generics and conditional types.
Examples:
Input 1: type Result = DeepReadonly<{ nested: { value: number } }>
Output 1: { readonly nested: { readonly value: number } }
Output
Run your code to see results.