Skip to content
Developer Preview

DeepReadonly

A recursively read-only view of a value.

The fold’s snapshot getters hand back its OWN stored objects — copying every read would cost more than the fold saves — and the generated wire types carry no readonly, so without this a consumer could write through a snapshot into fold state. This is composition over the generated types, never a restatement of one.

readonly is compile-time only; this is a type-level seal against accidental writes, not a runtime freeze. The alternative — deep-freezing or cloning on every read — would be a real cost on the hot path for a hazard the compiler can price at zero.

Source

clients/sdk-ts/src/fold/session-fold.ts:170

{
"kind": "Type alias",
"canonicalPath": "DeepReadonly"
}