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

Types conflict between jwks-rsa's @types/express-jwt@0 and express-jwt@7.5.0 #299

Closed
carboneater opened this issue Apr 28, 2022 · 4 comments

Comments

@carboneater
Copy link
Contributor

Describe the problem

Using express-jwt@7.5.0, with included types definitions, the types as linked by jwks-rsa@2.1.0 are ignored.

express-jwt@7 removed two types which are used in jwks-rsa@2's type definitions, thus leading to transpilation errors.

What was the expected behavior?

TS Code using express-jwt@7 & jwks-rsa@2 should transpile without errors

Reproduction

I did a small proof of concept for the transpilation issue, based on the example code for using multiple jwt providers.

node_modules/jwks-rsa/index.d.ts:1:10 - error TS2305: Module '"express-jwt"' has no exported member 'SecretCallback'.

1 import { SecretCallback, SecretCallbackLong } from 'express-jwt';
           ~~~~~~~~~~~~~~

node_modules/jwks-rsa/index.d.ts:1:26 - error TS2305: Module '"express-jwt"' has no exported member 'SecretCallbackLong'.

1 import { SecretCallback, SecretCallbackLong } from 'express-jwt';
                           ~~~~~~~~~~~~~~~~~~


Found 2 errors in the same file, starting at: node_modules/jwks-rsa/index.d.ts:1

Environment

  • Version of this library used: 2.1.0
  • Which framework are you using, if applicable: None in the PoC. Express usually
  • Other modules/plugins/libraries that might be involved: express-jwt@7.5.2
  • Any other relevant information you think would be useful:
@bombillazo
Copy link

Oh uh! Just updated express-jwt and here I am. 😞 Any workaround?

@bombillazo
Copy link

@carboneater
Copy link
Contributor Author

This package probably need supdating:

No,
Express-JWT@7 provides its own types, @types/express-jwt works as expected in stating it is now pointless to install and should be uninstalled.

As a matter of fact, the root cause of your issues is because the types are overriden by those provided by express-jwt.

@carboneater
Copy link
Contributor Author

#301 should fix this one

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

2 participants