title | nav_order | permalink |
---|---|---|
Assert.ts |
2 |
/assert/ |
Added in v2.2.0
A trait which will throw an error for when an expected "output" value does not match a schema's output type
Signature
export declare const deriveAssert: <I, O>(schema: Schema<I, O>) => Assert<O>
Added in v2.2.0
A trait which will throw an error for when an expected "input" value does not match a schema's input type
Signature
export declare const deriveInputAssert: <I, O>(schema: Schema<I, O>) => Assert<I>
Added in v2.2.0
A trait which will throw an error for when an expected "input" value does not match a schema's input type
Unlike deriveInputAssert
, this will include the error tree in the error message
Signature
export declare const deriveInputAssertTree: <I, O>(schema: Schema<I, O>) => Assert<I>
Added in v2.2.0
A trait which will throw an error for when a value does not match a schema
Signature
export interface Assert<T> {
readonly assert: (output: unknown) => asserts output is T
}
Added in v2.2.0