Skip to content

Commit

Permalink
Suppress Polka's app.handler type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aradalvand committed Jun 18, 2023
1 parent 114a589 commit 43c5b89
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/adapter-node/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export const no_http2 = env('NO_HTTP2', false);
const app = polka().use(handler);

if (!only_https) {
// TODO Remove the `@ts-expect-error`s below once https://github.com/lukeed/polka/issues/194 is fixed
// @ts-expect-error
http.createServer(app.handler).listen({ path, host, port }, () => {
console.log(`Listening on http://${path ? path : host + ':' + port}`);
});
Expand All @@ -27,10 +29,12 @@ if (cert_path && cert_key_path) {
const cert = fs.readFileSync(cert_path);
const key = fs.readFileSync(cert_key_path);
const https_server = no_http2
? https.createServer({ cert, key }, app.handler)
: http2.createSecureServer({ allowHTTP1: true, cert, key }, app.handler);
? // @ts-expect-error
https.createServer({ cert, key }, app.handler)
: // @ts-expect-error
http2.createSecureServer({ allowHTTP1: true, cert, key }, app.handler);

https_server.listen({ path, host, https_port }, () => {
https_server.listen({ path, host, port: https_port }, () => {
console.log(`Listening on https://${path ? path : host + ':' + https_port}`);
});
}
Expand Down

0 comments on commit 43c5b89

Please sign in to comment.