bridgets
Version:
<p align="center"> <a href="https://bridgets.co"> <img src="http://bridgets.co/assets/logo-short.svg" height="48" /> <h1 align="center">BridgeTS</h1> </a> </p>
28 lines • 987 B
TypeScript
import { AbstractHandler, Handler } from '../handler';
declare type YupParser<T = any> = {
validateSync: (input: unknown) => T;
};
declare type SuperstructParser<T = any> = {
create: (input: unknown) => T;
};
declare type ZodParser<T = any> = {
parse: (input: any) => T;
};
export declare type DataParser<T = any> = YupParser<T> | ZodParser<T> | SuperstructParser<T>;
export declare type InferDataParser<Val extends DataParser> = Val extends DataParser<infer Output> ? Output : any;
export declare const isZodParser: (parser: any) => parser is ZodParser<any>;
/**
*
*/
export declare class DataValidator<Output = any> extends AbstractHandler {
private parser;
private dataToValidate;
output: Output;
constructor(parser: DataParser<Output>, dataToValidate: 'body' | 'query' | 'headers');
private isYupParser;
private isSuperstructParser;
private isZodParser;
handle: Handler['handle'];
}
export {};
//# sourceMappingURL=dataValidator.d.ts.map