fridays / next-routes

Universal dynamic routes for Next.js
MIT License
2.47k stars 230 forks source link

Wrong typings for customHandler #295

Closed liss-mouse closed 1 year ago

liss-mouse commented 5 years ago

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