diff --git a/types/express-serve-static-core/express-serve-static-core-tests.ts b/types/express-serve-static-core/express-serve-static-core-tests.ts index 4e9f75a5ad..ccd70e7a1f 100644 --- a/types/express-serve-static-core/express-serve-static-core-tests.ts +++ b/types/express-serve-static-core/express-serve-static-core-tests.ts @@ -9,6 +9,12 @@ app.listen(3000, (err: any) => { app.get('/:foo', req => { req.params.foo; // $ExpectType string req.params[0]; // $ExpectType string + // $ExpectType string | false | null + req.is(['application/json', 'application/xml']); + // $ExpectType string | false | null + req.is('audio/wav'); + // $ExpectError + req.is(1); }); // Params can used as an array diff --git a/types/express-serve-static-core/index.d.ts b/types/express-serve-static-core/index.d.ts index 519dbbbb87..9095a3bec2 100644 --- a/types/express-serve-static-core/index.d.ts +++ b/types/express-serve-static-core/index.d.ts @@ -7,6 +7,7 @@ // Sami Jaber // aereal // Jose Luis Leon +// David Stephens // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -368,7 +369,7 @@ export interface Request

false */ - is(type: string): string | false; + is(type: string | string[]): string | false | null; /** * Return the protocol string "http" or "https"