StandardSchemaV1
A schema that conforms to the Standard Schema v1 specification.
- Import:
@kjanat/dreamcli - Export kind: interface
- Declared in:
src/core/schema/standard.ts - Source link:
src/core/schema/standard.ts:12
Signatures
ts
interface StandardSchemaV1<Input, Output> {}Members
Properties
~standard
The Standard Schema properties, namespaced under a well-known key.
ts
"~standard": StandardSchemaV1.Props<Input, Output>;Signatures
Props
The properties exposed under a validator's ~standard key.
ts
interface Props<Input, Output> {}Options
Optional parameters passed to a validator.
ts
interface Options {}Result
The result of validating a value: either its output or a list of issues.
ts
type Result<Output> = SuccessResult<Output> | FailureResult;SuccessResult
A successful validation carrying the parsed output value.
ts
interface SuccessResult<Output> {}FailureResult
A failed validation carrying validation issues.
ts
interface FailureResult {}Issue
A single validation issue.
ts
interface Issue {}PathSegment
One segment of an issue path.
ts
interface PathSegment {}Types
The type-level input and output carried by a validator.
ts
interface Types<Input, Output> {}InferInput
Infer the input type of a Standard Schema validator.
ts
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];InferOutput
Infer the output type of a Standard Schema validator.
ts
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];Related Examples
- Standard Schema validation for custom flags and args. -
examples/standard-schema.ts