Skip to content

Documentation / @super-line/core / validateSync

Function: validateSync() ​

validateSync<S>(schema, value): InferOutput<S>

Defined in: packages/core/src/contract.ts:528

Synchronous validation for hot paths (e.g. client inbound dispatch).

Type Parameters ​

S ​

S extends Schema<unknown, unknown>

Parameters ​

schema ​

S

the validator to run.

value ​

unknown

the untrusted value to validate.

Returns ​

InferOutput<S>

the parsed, typed value.

Throws ​

SuperLineError with code VALIDATION on mismatch, or INTERNAL if the schema is async.

Released under the MIT License.