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 bundled with connect-redis are broken #416

Closed
gegenschall opened this issue Dec 4, 2024 · 6 comments
Closed

Types bundled with connect-redis are broken #416

gegenschall opened this issue Dec 4, 2024 · 6 comments

Comments

@gegenschall
Copy link

Hey there. Trying to use connect-redis from a CommonJS context with the following tsconfig.json:

"compilerOptions": {
  // ...
  "module": "NodeNext",
  "target": "ES2022",
  "moduleResolution": "NodeNext"
  // ...
}

Configured like this, connect-redis does not bundle any type information at all, see here. That leads to TypeScript being unable to import:

src/main.ts:4:28 - error TS7016: Could not find a declaration file for module 'connect-redis'. '/app/node_modules/.pnpm/[email protected][email protected]/node_modules/connect-redis/dist/connect-redis.cjs' implicitly has an 'any' type.
Try `npm i --save-dev @types/connect-redis` if it exists or add a new declaration (.d.ts) file containing `declare module 'connect-redis';`

4 import { RedisStore } from 'connect-redis';
                             ~~~~~~~~~~~~~~~
@SARAN-thala
Copy link

facing the same issue in my project.

@wavded
Copy link
Collaborator

wavded commented Dec 4, 2024

Thx for reporting, not sure why CJS bundle is not picking up the types but ESM is. Will look at it.

@wavded
Copy link
Collaborator

wavded commented Dec 4, 2024

Can either of you test npm install connect-redis@next and see if it is working for you. It seems to pass now:

https://arethetypeswrong.github.io/?p=connect-redis%408.0.1-rc.2

@gegenschall
Copy link
Author

CJS vs ESM is so much fun. /s

@wavded, 8.0.1-rc.2 seems to work fine for me. Awesome!

@wavded
Copy link
Collaborator

wavded commented Dec 4, 2024

Thanks for checking @gegenschall , I will publish an official release shortly.

wavded added a commit that referenced this issue Dec 4, 2024
wavded added a commit that referenced this issue Dec 4, 2024
@wavded
Copy link
Collaborator

wavded commented Dec 4, 2024

Fixed in 8.0.1

@wavded wavded closed this as completed Dec 4, 2024
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

3 participants