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

Type incompatibility with Deno 1.20.1 #164

Closed
AEtheve opened this issue Mar 19, 2022 · 5 comments · Fixed by #165
Closed

Type incompatibility with Deno 1.20.1 #164

AEtheve opened this issue Mar 19, 2022 · 5 comments · Fixed by #165
Labels
bug Something isn't working

Comments

@AEtheve
Copy link
Contributor

AEtheve commented Mar 19, 2022

Issue

Setup:

  • Deno Version: 1.20.1
  • v8 Version: 10.0.139.6
  • Typescript Version: 4.6.2
  • Opine Version: 2.1.4

Details

There is a type incompatibility with Deno 1.20.1 for listenAndServeTls :

error: TS2345 [ERROR]: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
  Type 'undefined' is not assignable to type 'string'.
          await server.listenAndServeTls(options.certFile, options.keyFile);
                                         ~~~~~~~~~~~~~~~~
    at ./src/application.ts
@AEtheve
Copy link
Contributor Author

AEtheve commented Mar 19, 2022

I fixed it temporarily by replacing
if (isTls) { in application.ts
with :
if (isTls && typeof options.certFile == "string" && typeof options.keyFile == "string") {

@cmorten cmorten added the bug Something isn't working label Mar 20, 2022
@cmorten
Copy link
Owner

cmorten commented Mar 20, 2022

Yeah seems types just slightly mismatching now.

ListenTlsOptions have all pertinent keys as optional https://doc.deno.land/deno/stable/~/Deno.ListenTlsOptions which is inherited by opine’s HTTPSOptions https://github.com/cmorten/opine/blob/main/src/types.ts#L22 so isTls isn’t quite cutting it anymore.

Think solution would be to adjust HTTPSOptions defined in opine’s types to have the key and cert keys as non-optional.

@AEtheve
Copy link
Contributor Author

AEtheve commented Mar 20, 2022

Ok, fine, that's what I thought, thanks.

cmorten pushed a commit that referenced this issue Mar 20, 2022
* Update HTTPSOptions to make it compatible with Deno 1.20.1
@cawoodm
Copy link

cawoodm commented May 1, 2022

Sorry, what's the fix here? I'm getting this error with opine 2.1.4 AFAIK the latest version.

@cmorten
Copy link
Owner

cmorten commented May 2, 2022

@cawoodm what is the error you are seeing? The fix for this issue was to use latest opine on latest deno (deno upgrade).

If you're still facing issues, feel free to raise a new issue with the error you are seeing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants