-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
"import Redis" is flagged as invalid constructor function type in ESM TypeScript project #1642
Comments
Resolved as do: import { default as Redis } from 'ioredis'
export class RedisClient extends Redis.default {
// ... whatever
} |
I'd say this issue should be re-opened as the workaround is kind of odd. |
I assume would be better open a new ticket. |
I disagree, as it would be a duplicate of this unresolved issue. But I'll do that if you don't want to open the issue. |
@luin I re-open this issue because the behavior is odd and still would be problem. Tracking of: |
|
The problem is that despite using that import statement one still has to use Example: import { default as Redis } from 'ioredis';
const redis = new Redis.default(); The named Redis export is only exported as a type. Which is kind of strange as well. |
I can confirm that the normal import doesn't work when using import RedisModule from 'ioredis'
// FIXME: https://github.com/luin/ioredis/issues/1642
const Redis = RedisModule.default |
I also use node16, and trapped by this @luin |
2 similar comments
I also use node16, and trapped by this @luin |
I also use node16, and trapped by this @luin |
Looks like this issue has been fixed in v5.2.5. Issue can be closed. |
Fixed in #1695 |
I had to do this to get started
Same issue as:
They prints:
Type 'typeof import("node_modules/.pnpm/ioredis@5.2.3/node_modules/ioredis/built/index")' is not a constructor function type.
My project settings are:
TSConfig:
The text was updated successfully, but these errors were encountered: