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

v5 does not re-exporting all the types correctly #1559

Closed
abriginets opened this issue Apr 3, 2022 · 4 comments · Fixed by #1560
Closed

v5 does not re-exporting all the types correctly #1559

abriginets opened this issue Apr 3, 2022 · 4 comments · Fixed by #1560
Labels

Comments

@abriginets
Copy link

Hello. I've recently upgraded to ioredis v5 and mentioned that many types are no longer exported or exported incorectly from the library. For example, I'm using NestJS for the backend and I don't like to make 3rd party library calls directly. Instead I prefer to wrap those calls into a separate injectable class so that there only will be a single instance of redis client for my app. And it's easier to test stuff by to mocking a class instead of 3rd party library calls. Previously I had a following method:

async set(key: Redis.KeyType, value: Redis.ValueType, expiry?: string, time?: number): Promise<'OK'> {
  if (expiry) {
    return await this.instance.set(key, value, expiry, time);
  }

  return await this.instance.set(key, value);
}

I was using Redis.KeyType and Redis.ValueType which are no longer exported from the library but are actually still defined in the source code.

Also redis.pipeline() call was returning Redis.Pipeline type which now is called ChainableCommander, but when I'm switching from

pipeline(): Redis.Pipeline {
  return this.instance.pipeline();
}

to

pipeline(): ChainableCommander {
  return this.instance.pipeline();
}

VSCode auto-imports it from ioredis/built/utils/RedisCommander which really looks ugly.

Is there a way to make new typings to act like those from @types/ioredis?

@luin
Copy link
Collaborator

luin commented Apr 4, 2022

Hey @abriginets 👋

Going to expose those types in #1560. Let me know if there are any types missing.

@jliana-cksource
Copy link

Hi @luin, could you also expose DNSLookupFunction?

@luin
Copy link
Collaborator

luin commented Apr 6, 2022

Hi @jliana-cksource, just added it in #1560. Will release it next Monday.

@luin luin closed this as completed in #1560 Apr 9, 2022
@github-actions
Copy link

github-actions bot commented Apr 9, 2022

🎉 This issue has been resolved in version 5.0.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants