Skip to content

Commit 1636a89

Browse files
author
Mateusz Stawecki
committed
TS support api.register/routes, req.namespace #137
1 parent 11c6ddd commit 1636a89

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

index.d.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ export declare interface FileOptions {
3232
private?: boolean;
3333
}
3434

35+
export declare interface RegisterOptions {
36+
prefix?: string;
37+
}
38+
3539
export declare interface App {
36-
[namespace: string]: HandlerFunction;
40+
[namespace: string]: any;
3741
}
3842

3943
export declare type Middleware = (req: Request, res: Response, next: () => void) => void;
@@ -138,6 +142,7 @@ export declare class Request {
138142
userAgent: string;
139143
clientType: 'desktop' | 'mobile' | 'tv' | 'tablet' | 'unknown';
140144
clientCountry: string;
145+
namespace: App;
141146

142147
log: {
143148
trace: LoggerFunction;
@@ -202,7 +207,10 @@ export declare class API {
202207
any(...handler: HandlerFunction[]): void;
203208
METHOD(method: METHODS, path: string, ...handler: HandlerFunction[]): void;
204209
METHOD(method: METHODS, ...handler: HandlerFunction[]): void;
205-
210+
register(routes: (api: API, options?: RegisterOptions) => void, options?: RegisterOptions): void;
211+
routes(format: true): void;
212+
routes(format: false): string[][];
213+
routes(): string[][];
206214

207215

208216

0 commit comments

Comments
 (0)