Express's `Middleware` type is not correct
See original GitHub issue declare type Middleware =
((req: Request, res: Response, next: NextFunction) => mixed)|
((error: ?Error, req : Request, res: Response, next: NextFunction) => mixed);
I don’t know how flow handle union type of function. But according to the doc and variance rule, Middleware should be an intersection type, not union type.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:16 (7 by maintainers)
Top Results From Across the Web
Express Typescript use the correct types for error middleware
Trying to get my types correct in express. I have the following middleware error function. I cannot seem to get the types correct...
Read more >Using middleware - Express.js
An Express application can use the following types of middleware: Application-level middleware; Router-level middleware; Error-handling middleware; Built-in ...
Read more >Express plugin does not work correctly when automatic ...
When disabling automatic loading of all plugins and enabling only the express one, full traces (express.request and express.middleware ...
Read more >Complete Guide to Express Middleware - Reflectoring
If the value of the content-type header does not match application/json , we are sending back an error response with status 400 accompanied...
Read more >How To Use And Write Express Middleware
This middleware now checks to see if the query parameter admin=true is in the URL and if it is not an error message...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vkurchatkin Is there no way for flow to determine the types based on arity?
Is this issue still happening with the very latest version of the definition?