Skip to main content

Function: withImmutableState()

Call Signature

withImmutableState<State>(state, options?): SignalStoreFeature<SignalStoreFeatureResult, EmptyFeatureResult & object>

Defined in: libs/ngrx-toolkit/src/lib/immutable-state/with-immutable-state.ts:54

Prevents mutation of the state.

This is done by deeply applying Object.freeze. Any mutable change within or outside the SignalStore will throw an error.

Type Parameters

State extends object

Parameters

state

State

the state object

options?

enable protection in production (default: false)

enableInProduction

boolean

Returns

SignalStoreFeature<SignalStoreFeatureResult, EmptyFeatureResult & object>

Call Signature

withImmutableState<State>(stateFactory, options?): SignalStoreFeature<SignalStoreFeatureResult, EmptyFeatureResult & object>

Defined in: libs/ngrx-toolkit/src/lib/immutable-state/with-immutable-state.ts:70

Prevents mutation of the state.

This is done by deeply applying Object.freeze. Any mutable change within or outside the SignalStore will throw an error.

Type Parameters

State extends object

Parameters

stateFactory

() => State

a function returning the state object

options?

enable protection in production (default: false)

enableInProduction

boolean

Returns

SignalStoreFeature<SignalStoreFeatureResult, EmptyFeatureResult & object>