StateConfig
classThe return value of createState, for use with $getState and $setState.
Import
import { StateConfig } from '@modular/sdk/editor';Members7
- defaultValue
VThe result of `stateValueConfig.parse(undefined)`, which is computed only once and used as the default value. When the current value `isEqual` to the `defaultValue`, it will not be serialized to JSON.
- isEqual
(a: V, b: V) => booleanAn equality function from the StateValueConfig, with a default of Object.is.
- key
KThe string key used when serializing this state to JSON
- parse
(value?: unknown) => VThe parse function from the StateValueConfig passed to createState
- resetOnCopyNode
boolean- schemaoptional
AnySerializationSchemaThe SerializationSchema for this state's value, present when its `parse` is a schema (e.g. `createState('mode', {parse: enumValue([...])})`). It exposes the value's introspectable domain so tooling such as `@lexical/fast-check` can generate examples of this state. It is undefined when `parse` is a plain function with no schema metadata.
- unparse
(value: V) => unknownThe unparse function from the StateValueConfig passed to createState, with a default that is simply a pass-through that assumes the value is JSON serializable.