shelving
Version:
Toolkit for using data in JavaScript.
9 lines (8 loc) • 436 B
TypeScript
import type { Schema } from "./Schema.js";
import { ThroughSchema } from "./ThroughSchema.js";
/** Validate a value of a specifed type, but throw `"Required"` if the validated value is falsy. */
export declare class RequiredSchema<T> extends ThroughSchema<T> {
validate(unsafeValue: unknown): T;
}
/** Create a new required schema from a source schema. */
export declare const REQUIRED: <T>(source: Schema<T>) => RequiredSchema<T>;