flow-typed: Express's `Middleware` type is not correct

  declare type Middleware =
    ((req: Request, res: Response, next: NextFunction) => mixed)|
    ((error: ?Error, req : Request, res: Response, next: NextFunction) => mixed);

https://github.com/flowtype/flow-typed/blob/master/definitions/npm/express_v4.x.x/flow_v0.25.x-/express_v4.x.x.js#L90

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.

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Reactions: 1
  • Comments: 16 (7 by maintainers)

Most upvoted comments

@vkurchatkin Is there no way for flow to determine the types based on arity?