Skip to main content

Interface: Schema<OBJECT>

Validates that the structure of a value matches this schema.

Type parameters

Name
OBJECT

Implemented by

Methods

validate

validate(value): { success: true ; value: OBJECT } | { error: unknown ; success: false }

Validates that the structure of a value matches this schema, and returns a typed version of the value if it does.

Parameters

NameType
valueunknown

Returns

{ success: true ; value: OBJECT } | { error: unknown ; success: false }

Defined in

packages/modelfusion/src/core/schema/Schema.ts:9

Properties

_type

Readonly _type: OBJECT

Only used for type inference.

Defined in

packages/modelfusion/src/core/schema/Schema.ts:16