Skip to content

Documentation / @super-line/core / validateSync

Function: validateSync()

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

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

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

Type Parameters

S

S extends Schema

Parameters

schema

S

the validator to run.

value

unknown

the untrusted value to validate.

Returns

InferOutput<S>

the parsed, typed value.

Throws

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

Released under the MIT License.