Skip to main content

objectValue

function

Compose per-property SerializationSchemas into a single SerializationSchema for an object-valued property. Calling it coerces each known property in turn (ignoring any extra properties), so `objectValue(...)` applied to a partial or untrusted object returns a fully-populated, validated object; `objectValue(...)(undefined)` returns the all-defaults object. Its fields name no accessor: an object's field is not a node's property, which is what nodeSchema — the same record, checked against a node — is for.

function objectValue<const S extends InnerSerializationSchemaFields>(fields: S): ObjectSchema<S>

Import

import { objectValue } from '@modular/sdk/editor';

Notes

example
```ts // A property whose value is an object of its own; a node's own schema is // nodeSchema<MyNode>()({...}), whose fields may name accessors. const dimensions = objectValue({ height: numberValue(), width: numberValue(), }); ```
__NO_SIDE_EFFECTS__