question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

passport typescript type conflict

See original GitHub issue

Trying to use this package along with a custom passport strategy with express.

Issue is that this package includes the definitions from express-jwt, which are causing issues with projects that include both passport and node-jwks-rsa.

https://github.com/DefinitelyTyped/DefinitelyTyped/issues/23976

Any recommendations to resolve this conflict of the Request.user type?

node_modules/@types/express-jwt/index.d.ts(43,13): error TS2717: Subsequent property declarations must have the same type.  Property 'user' must be of type 'User | undefined', but here has type 'any'.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
wyattjohcommented, Jul 13, 2018

Sure @joshcanhelp!

You can grab the following repo/branch: https://github.com/coralproject/talk/pull/1743

git clone https://github.com/coralproject/talk.git
cd talk
git checkout next-passport
npm install
npm run compile:graphql
npm run build:server

That currently, will throw the following error:

node_modules/@types/express-jwt/index.d.ts(43,13): error TS2717: Subsequent property declarations must have the same type.  Property 'user' must be of type 'User | undefined', but here has type 'any'.
1reaction
joshcanhelpcommented, Jul 16, 2018

PR submitted: DefinitelyTyped/DefinitelyTyped#27339

Read more comments on GitHub >

github_iconTop Results From Across the Web

Override module declaration of passport set by third party ...
This is giving my a typescript error with overloading, ... Argument of type '"azuread-openidconnect"' is not assignable to parameter of type ...
Read more >
@types/passport - npm
Start using @types/passport in your project by running `npm i ... TypeScript icon, indicating that this package has built-in type ...
Read more >
Extending Express' Types with TypeScript Declaration Merging
To keep it simple, let's imagine we have some middleware (e.g. passport) that makes the current user available on each request, in the...
Read more >
Documentation: Strategies - Passport.js
Strategies are responsible for authenticating requests, which they accomplish by implementing an authentication mechanism. Authentication mechanisms define how ...
Read more >
Use TypeScript to Build a Node API with Express
Request type. Installing @types/passport and assing "passport" to the "types" list of tsconfig.json fixed it ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found