StandardSchemaV1
The Standard Schema v1 interface, inlined.
Inlined rather than depended on, which is the whole point of the spec: it is
a shape, not a package. Zod, Valibot and ArkType all expose ~standard, so
accepting this type means accepting any of them — and any hand-written
validator — without this library taking a dependency on, or a position about,
which one you use.
Only the parts that are read here are declared. The full spec has more.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Input | unknown |
Output | Input |
Properties
Section titled “Properties”~standard
Section titled “~standard”readonly ~standard: object;types?
Section titled “types?”readonly optional types?: object;types.input
Section titled “types.input”readonly input: Input;types.output
Section titled “types.output”readonly output: Output;validate
Section titled “validate”readonly validate: (value) => | StandardSchemaResult<Output>| Promise<StandardSchemaResult<Output>>;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value | unknown |
Returns
Section titled “Returns”| StandardSchemaResult<Output>
| Promise<StandardSchemaResult<Output>>
vendor
Section titled “vendor”readonly vendor: string;version
Section titled “version”readonly version: 1;