next-routes icon indicating copy to clipboard operation
next-routes copied to clipboard

Wrong typings for customHandler

Open liss-mouse opened this issue 5 years ago • 0 comments

From the readme and the code, I can see that custom handler provided to the getRequestHandler accepts an object

const handler = routes.getRequestHandler(app, ({req, res, route, query}) => {
  app.render(req, res, route.page, query)
})

But in type definitions, the type of the handler differs:

export type HTTPHandler = (
  request: IncomingMessage,
  response: ServerResponse
) => void

so that TS fails to compile

liss-mouse avatar Mar 21 '19 17:03 liss-mouse