Skip to content

Commit 46bbea6

Browse files
authored
Update middlewares.md
Type for the `next` parameter should be `NextFunction` https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/express/index.d.ts#L107 Even eslint gives an error: `Don't use `Function` as a type. The `Function` type accepts any function-like value.`
1 parent b6b10d0 commit 46bbea6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/middlewares.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ You implement custom Nest middleware in either a function, or in a class with an
2323
```typescript
2424
@@filename(logger.middleware)
2525
import { Injectable, NestMiddleware } from '@nestjs/common';
26-
import { Request, Response } from 'express';
26+
import { Request, Response, NextFunction } from 'express';
2727

2828
@Injectable()
2929
export class LoggerMiddleware implements NestMiddleware {
30-
use(req: Request, res: Response, next: Function) {
30+
use(req: Request, res: Response, next: NextFunction) {
3131
console.log('Request...');
3232
next();
3333
}

0 commit comments

Comments
 (0)