import { NextFunction, Request, Response } from 'express'; import { TypeInfo } from 'rtti'; import { ExtractMethod, ExtractPath, NamedParams, RequestBody, ResponseBody } from '../util'; import { HttpSchema, Method } from '../shared'; /** * Accepts and returns a request handler function that is strongly-typed to match the given schema definition for the * given method and path. The function is returned as-is. This helper just provides convenient contextual typing. */ export declare function createRequestHandler(schema: S, route: R, handler: RequestHandler, ExtractPath, {}>): RequestHandler, ExtractPath, {}>; /** * Accepts and returns a request handler function that is strongly-typed to match the given schema definition for the * given method and path. The function is returned as-is. This helper just provides convenient contextual typing. */ export declare function createRequestHandler>(options: { schema: S; route: R; requestProps?: ReqProps; handler: RequestHandler, ExtractPath, ReqProps['example']>; }): RequestHandler, ExtractPath, {}>; /** * Accepts and returns a request handler function that is strongly-typed to match the given schema definition for the * given method and path. The function is returned as-is. This helper just provides convenient contextual typing. */ export declare function createRequestHandler(schema: S, method: M, path: P, handler: RequestHandler): RequestHandler; /** * Accepts and returns a request handler function that is strongly-typed to match the given schema definition for the * given method and path. The function is returned as-is. This helper just provides convenient contextual typing. */ export declare function createRequestHandler>(options: { schema: S; method: M; path: P; requestProps?: ReqProps; handler: RequestHandler; }): RequestHandler; /** A strongly-typed express request handler. */ export declare type RequestHandler = (req: TypedRequest, res: TypedResponse, next: NextFunction) => void | Promise; /** A strongly-typed express request. Some original props are omited and replaced with typed ones. */ declare type TypedRequest = Omit, string>>, 'body'> & Req & { body: RequestBody extends undefined ? {} : RequestBody; [Symbol.asyncIterator](): AsyncIterableIterator; }; /** A strongly-typed express response. Some original props are omited and replaced with typed ones. */ declare type TypedResponse = Omit & { end: never; json: (body: ResponseBody) => TypedResponse; jsonp: (body: ResponseBody) => TypedResponse; send: (body: ResponseBody) => TypedResponse; status: (code: number) => TypedResponse; }; export {};