Description
The HTTPS example shows app.handler
being passed to https.createServer
as the request handler, and this does work, but you get type errors when you do it, which leads me to believe there must be something wrong with Polka's types here:
This is the case for all three of http
, https
, and http2
.
The error for http.createServer
reads:
Argument of type 'Middleware' is not assignable to parameter of type 'RequestListener<typeof IncomingMessage, typeof ServerResponse>'.
Target signature provides too few arguments. Expected 3 or more, but got 2.ts(2345)
For https.createServer
:
Argument of type 'Middleware' is not assignable to parameter of type 'RequestListener<typeof IncomingMessage, typeof ServerResponse>'.ts(2345)
And http2.createSecureServer
:
Argument of type 'Middleware' is not assignable to parameter of type '(request: Http2ServerRequest, response: Http2ServerResponse) => void'.
Target signature provides too few arguments. Expected 3 or more, but got 2.ts(2345)