@threadplane/coreFunctionv0.0.0

readState

Unpublished development API. This package is under development and is not available as a published release.

Checks a state a backend reported against a session's declaration. For session implementations.

With no declaration, or a type() declaration, every value is valid and returned as given. With a schema, the value is the schema's output, so a transformed field holds its transformed value. A schema that validates asynchronously is reported as invalid: a snapshot is published synchronously and cannot wait for it.

import { readState } from '@threadplane/core';

Declaration · overload 1

export declare function readState(declaration: StateDeclaration | undefined, value: unknown): StateReading;

Parameters

declaration · required
StateDeclaration | undefined
value · required
unknown

Returns

StateReading