turtle-express
Version:
`turtle-express` is kinda a framework or a library based on `express.js` with an opinionated express router with type safety and schema validation with zod. Also many [more features](https://github.com/mm-ninja-turtles/turtle-express/discussions/7) planni
14 lines • 849 B
TypeScript
import { Request } from 'express';
import { z, ZodType } from 'zod';
import { HandlerRequest } from './create-handler';
export interface RequestValidationReturnType<Params extends ZodType | unknown, Query extends ZodType | unknown, Body extends ZodType | unknown> {
context: {
params: z.SafeParseReturnType<Params, Params> | null;
query: z.SafeParseReturnType<Query, Query> | null;
body: z.SafeParseReturnType<Body, Body> | null;
};
ifSomeSchemasExists: () => boolean;
ifOneValidationFailed: () => boolean;
}
export declare function requestValidation<Params extends ZodType | unknown, Query extends ZodType | unknown, Body extends ZodType | unknown>(req: Request, schemas: HandlerRequest<Params, Query, Body>): RequestValidationReturnType<Params, Query, Body>;
//# sourceMappingURL=request-validation.d.ts.map