From fe6cc1d77b380c4b0ce7be39f1676244a0d19abe Mon Sep 17 00:00:00 2001 From: Stefan Dobrev Date: Mon, 14 Nov 2016 16:36:45 +0200 Subject: [PATCH] [express] Add Router constructor options More info [here](http://expressjs.com/en/api.html#express.router) --- express/express-tests.ts | 3 +-- express/index.d.ts | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/express/express-tests.ts b/express/express-tests.ts index fdcd85801f..e643ba208b 100644 --- a/express/express-tests.ts +++ b/express/express-tests.ts @@ -29,8 +29,7 @@ namespace express_tests { res.send('hello world'); }); - const router = express.Router(); - + const router = express.Router({ caseSensitive: true, mergeParams: true, strict: true }); const pathStr: string = 'test'; const pathRE: RegExp = /test/; diff --git a/express/index.d.ts b/express/index.d.ts index b1a618b79e..7222c8d3d9 100644 --- a/express/index.d.ts +++ b/express/index.d.ts @@ -28,7 +28,28 @@ declare namespace e { */ var static: typeof serveStatic; - export function Router(options?: any): core.Router; + export function Router(options?: RouterOptions): core.Router; + + interface RouterOptions { + /** + * Enable case sensitivity. + */ + caseSensitive?: boolean; + + /** + * Preserve the req.params values from the parent router. + * If the parent and the child have conflicting param names, the child’s value take precedence. + * + * @default false + * @since 4.5.0 + */ + mergeParams?: boolean; + + /** + * Enable strict routing. + */ + strict?: boolean; + } interface Application extends core.Application { } interface CookieOptions extends core.CookieOptions { }