Recursively applies the readonly modifier to all properties of an object, array, Map, or Set.
Primitives and functions are returned as is.
Note: passing any yields a union of both conditional branches
(standard TypeScript behavior for any in conditional types).
Type Parameters
T
The type to make deeply readonly.
Returns
A new type with all nested properties marked as readonly.
Recursively applies the
readonlymodifier to all properties of an object, array, Map, or Set. Primitives and functions are returned as is. Note: passinganyyields a union of both conditional branches (standard TypeScript behavior foranyin conditional types).