routes/index.ts has TypeScript errors, eslint(@typescript-eslint/no-misused-promises) - express-generator-typescript
./sample-output/express-gen-ts/src/routes/index.ts
shows errors, eslint(@typescript-eslint/no-misused-promises)
, for the handler arguments in the router matcher functions:
Promise returned in function argument where a void return was expected.
2 Answer:
You'll have to take away that linting option no-misused promises. It's very common to have pass asynchronous functions to express routes.
FYI, this rule included in "plugin:@typescript-eslint/recommended-requiring-type-checking"
you can check this code from package.json > eslintConfig > extends
.
If you do want disable this linting option, just add this "@typescript-eslint/no-misused-promises": 0
, on package.json > eslintConfig > rules
.
If you want to check all the rules included in "recommended-requiring-type-checking", you can find its list from node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended-requiring-type-checking.js
Read next
- Docker Build failed with exit code -1 on create new container - PowerShell navcontainerhelper
- Blazorise datagrid begin edit C#
- mocha grep behaviour is badly documented - JavaScript
- Progress bar for subdomain enumeration - Shell reconftw
- forem Replace PodcastEpisodes's social preview with HtmlCssToImage Ruby
- framework Eloquent dirty check for collections PHP
- darktable Color zones: show selected area (enhancement) C
- [Table] Incorrect font family for header - components