API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

T

typeDeepReadonly

@codexo/exojs / core / stable

Marks every property of `T` `readonly`, recursively: nested objects, arrays, tuples, `Map` and `Set` are all rewritten, so a descriptor handed to a caller can be typed as read-only in one annotation instead of one `readonly` per level. Arrays become `readonly T[]` (no `push`, no index assignment), tuples keep their arity, and primitives pass through unchanged. This is a type-level guarantee only; nothing is frozen at runtime. Use it for **data** - configuration, descriptors, theme and style records, anything a caller reads but must not write. It is not the right tool for a class instance: the mapped type drops private fields, so `DeepReadonly<Color>` is not assignable to `Color`, and methods are passed through callable, which means an instance mutator such as `set()` still type-checks and still mutates. A class that must not be written to needs `Object.freeze` under `__DEV__` instead, the way Color's shared corners do it.

0
props
0
methods
0
events
Import
import { DeepReadonly } from '@codexo/exojs'

Marks every property of `T` `readonly`, recursively: nested objects, arrays, tuples, `Map` and `Set` are all rewritten, so a descriptor handed to a caller can be typed as read-only in one annotation instead of one `readonly` per level. Arrays become `readonly T[]` (no `push`, no index assignment), tuples keep their arity, and primitives pass through unchanged.

This is a type-level guarantee only; nothing is frozen at runtime.

Use it for **data** - configuration, descriptors, theme and style records, anything a caller reads but must not write. It is not the right tool for a class instance: the mapped type drops private fields, so `DeepReadonly<Color>` is not assignable to `Color`, and methods are passed through callable, which means an instance mutator such as `set()` still type-checks and still mutates. A class that must not be written to needs `Object.freeze` under `__DEV__` instead, the way Color's shared corners do it.

Definition1
T extends (args: never[]) => unknown ? T : T extends ReadonlyMap<Key, Value> ? ReadonlyMap<DeepReadonly<Key>, DeepReadonly<Value>> : T extends ReadonlySet<Value> ? ReadonlySet<DeepReadonly<Value>> : mapped
Source