Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polka<Request>.handler is not assignable to the handler argument of http.createServer? #194

Open
aradalvand opened this issue Jun 18, 2023 · 0 comments

Comments

@aradalvand
Copy link

aradalvand commented Jun 18, 2023

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:

image

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant