Shallow version of ().
Unlike (), there is no deep conversion: only root-level properties are made readonly. Property values are stored and exposed as-is - this also means properties with ref values will not be automatically unwrapped.
The source object.
const state = shallowReadonly({ foo: 1, nested: { bar: 2 }})// mutating state's own properties will failstate.foo++// ...but works on nested objectsisReadonly(state.nested) // false// worksstate.nested.bar++ Copy
const state = shallowReadonly({ foo: 1, nested: { bar: 2 }})// mutating state's own properties will failstate.foo++// ...but works on nested objectsisReadonly(state.nested) // false// worksstate.nested.bar++
Shallow version of ().
Unlike (), there is no deep conversion: only root-level properties are made readonly. Property values are stored and exposed as-is - this also means properties with ref values will not be automatically unwrapped.