Types bundled with connect-redis are broken
Hey there. Trying to use `connect-redis` from a CommonJS context with the following `tsconfig.json`:
```jsonc
"compilerOptions": {
// ...
"module": "NodeNext",
"target": "ES2022",
"moduleResolution": "NodeNext"
// ...
}
```
Configured like this, `connect-redis` does not bundle _any_ type information at all, see [here](https://arethetypeswrong.github.io/?p=connect-redis%408.0.0). 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/connect-redis@8.0.0_express-session@1.18.1/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';
~~~~~~~~~~~~~~~
```
关闭于 2024-12-04 6 条评论