Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/core / / validateOrThrow

Function: validateOrThrow()

ts
function validateOrThrow<T>(
   schema, 
   data, 
   what?): T;

Defined in: packages/core/src/utils/validation.ts:64

Throwing variant of validate(...) that surfaces a TypeError carrying a stable, parser-style message. Useful at module-boundary entry points where a thrown error is the natural failure mode.

Type Parameters

Type Parameter
T

Parameters

ParameterType
schemaZodLikeSchema&lt;T&gt;
dataunknown
what?string

Returns

T

Stable