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

Shouldn't express-session uses express as a peerDependency? #1018

Open
samishal1998 opened this issue Feb 7, 2025 · 1 comment
Open

Shouldn't express-session uses express as a peerDependency? #1018

samishal1998 opened this issue Feb 7, 2025 · 1 comment
Labels

Comments

@samishal1998
Copy link

Stack Trace

'import("~/node_modules/@types/express/index").Request<import("~/node_modules/@types/express-serve-static-core/index").ParamsDictionary, any, any, qs.ParsedQs, Record<string, any>>' is not assignable to parameter of type 'import("~/@namefi/namefi-api/node_modules/@types/express-session/node_modules/@types/express-serve-static-core/index").Request<import("~/@namefi/namefi-api/node_modules/@types/express-session/node_modules/@types/express-serve-static-core/index").ParamsDictionary, any, any, qs.ParsedQs, Record...'.
  The types of 'app.router' are incompatible between these types.
    Type 'string' is not assignable to type 'Router'.

37   })(request, response, next);

Environment information

Version:

"dependencies": {
  "express": "^4.18.2",
  "express-session": "^1.18.1"
}

Node.js version:

v20.17.0

Any other relevant information:

diagnosis

I was able to go through all the express packages and finally found that express-session@1.18.1 is using "express": "4.17.3" exactly(no '^ | ~') and it's used as a devDependency, so I set my express version 4.17.3 and it solves the issue.
This could be avoided if the express-session uses express a peerDependency

@bjohansebas
Copy link
Member

Express is only used for testing, so it doesn't make sense for it to be a peer dependency. The issue you're facing is more related to TypeScript types. Can you show which versions of types you're using?

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

No branches or pull requests

2 participants