diff --git a/express-serve-static-core/express-serve-static-core.d.ts b/express-serve-static-core/express-serve-static-core.d.ts index 8bb4863c6..70817018a 100644 --- a/express-serve-static-core/express-serve-static-core.d.ts +++ b/express-serve-static-core/express-serve-static-core.d.ts @@ -783,8 +783,7 @@ declare module "express-serve-static-core" { } interface NextFunction { - (): void; - (err: any): void; + (err?: any): void; } interface ErrorRequestHandler { diff --git a/express/express-tests.ts b/express/express-tests.ts index d344dc6eb..11f8fd44f 100644 --- a/express/express-tests.ts +++ b/express/express-tests.ts @@ -68,3 +68,6 @@ app.use((req, res, next) => { app.use(router); app.listen(3000); + +const next: express.NextFunction = () => {}; +const nextWithArgument: express.NextFunction = (err: any) => {};