dilswer
Version:
Blazingly fast data validation library with TypeScript integration.
19 lines (18 loc) • 766 B
TypeScript
import type { AnyType } from "../data-types/type-types";
import type { ParseDataType, ReWrap } from "../data-types/type-utils";
export interface FastValidator<DT extends AnyType> {
(data: unknown): data is ReWrap<ParseDataType<DT>>;
asString(name?: string): string;
}
/**
* Compile a validation function for the given data type.
*
* The compile function is extremely fast, but it is not possible
* to get detailed error messages from it.
*
* The compilation process takes a similar amount of time to
* validating using the `createValidator` function, so for the
* best performance, you should compile the validator
* ahead-of-time and reuse it.
*/
export declare const compileFastValidator: <DT extends AnyType>(dataType: DT) => FastValidator<DT>;