Skip to main content

Parse

type

A function that validates an untrusted `value` (such as a property parsed from JSON) and coerces it into the expected type `T`, returning a default value when `value` is not in the expected domain. By convention — and exactly like the `parse` of StateValueConfig — calling a `Parse` with `undefined` returns its default value.

type Parse<T> = (value: unknown) => T

Import

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