8000 update typescript definitions · jthomerson/lambda-api@0b2214b · GitHub
[go: up one dir, main page]

Skip to content

Commit 0b2214b

Browse files
committed
update typescript definitions
1 parent 11ed69b commit 0b2214b

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

index.d.ts

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export declare interface App {
3939
export declare type Middleware = (req: Request, res: Response, next: Middleware) => void;
4040
export declare type ErrorHandlingMiddleware = (error: Error, req: Request, res: Response, next: ErrorHandlingMiddleware) => void;
4141
export declare type ErrorCallback = (error?: Error) => void;
42-
export declare type HandlerFunction = (req: Request, res: Response) => void | {} | Promise<{}>;
42+
export declare type HandlerFunction = (req: Request, res: Response, next?: NextFunction) => void | {} | Promise<{}>;
4343
export declare type LoggerFunction = (message: string) => void;
4444
export declare type NextFunction = () => void;
4545
export declare type TimestampFunction = () => string;
@@ -175,20 +175,32 @@ export declare class API {
175175
app(namespace: string, handler: HandlerFunction): App;
176176
app(options: App): App;
177177

178-
get(path: string, handler: HandlerFunction): void;
179-
post(path: string, handler: HandlerFunction): void;
180-
put(path: string, handler: HandlerFunction): void;
181-
patch(path: string, handler: HandlerFunction): void;
182-
delete(path: string, handler: HandlerFunction): void;
183-
options(path: string, handler: HandlerFunction): void;
184-
head(path: string, handler: HandlerFunction): void;
185-
any(path: string, handler: HandlerFunction): void;
186-
METHOD(method: METHODS, path: string, handler: HandlerFunction): void;
187-
188-
189-
use(paths: string[], middleware: Middleware);
190-
use (middleware: Middleware);
191-
use (errorHandlingMiddleware: ErrorHandlingMiddleware);
178+
get(path: string, ...handler: HandlerFunction[]): void;
179+
get(...handler: HandlerFunction[]): void;
180+
post(path: string, ...handler: HandlerFunction[]): void;
181+
post(...handler: HandlerFunction[]): void;
182+
put(path: string, ...handler: HandlerFunction[]): void;
183+
put(...handler: HandlerFunction[]): void;
184+
patch(path: string, ...handler: HandlerFunction[]): void;
185+
patch(...handler: HandlerFunction[]): void;
186+
delete(path: string, ...handler: HandlerFunction[]): void;
187+
delete(...handler: HandlerFunction[]): void;
188+
options(path: string, ...handler: HandlerFunction[]): void;
189+
options(...handler: HandlerFunction[]): void;
190+
head(path: string, ...handler: HandlerFunction[]): void;
191+
head(...handler: HandlerFunction[]): void;
192+
any(path: string, ...handler: HandlerFunction[]): void;
193+
any(...handler: HandlerFunction[]): void;
194+
METHOD(method: METHODS, path: string, ...handler: HandlerFunction[]): void;
195+
METHOD(method: METHODS, ...handler: HandlerFunction[]): void;
196+
197+
198+
199+
200+
use(path: string, ...middleware: Middleware[]);
201+
use(paths: string[], ...middleware: Middleware[]);
202+
use (...middleware: Middleware[]);
203+
use (...errorHandlingMiddleware: ErrorHandlingMiddleware[]);
192204

193205
finally(callback: FinallyFunction): void;
194206

0 commit comments

Comments
 (0)
0