-
Notifications
You must be signed in to change notification settings - Fork 11
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
Error: ioredis dependency not found #15
Comments
I agree that we should be Redis-client agnostic. This is something I’ve thought about, but I haven’t had the bandwidth to try. We should accept any client that conforms to the de-facto standard callback interface given in I tried this in a side project. Maybe that could be adapted. Or I would be open to another approach as well. |
You can use the following syntax to remove the type Redis = import('ioredis').Redis |
I hit this same issue when compiling using tsc:
installing redis, and ioredis, and @types/redis doesn't make this error go away... https://stackoverflow.com/questions/70251426/module-redis-has-no-exported-member-redisclient The one solution of installing redis@3 diddn't work for me, same issue was apparent. my current short term solution is to comment out RedisQuoteManager from exports in index.d.ts:
|
Ran into the same compilation snag you've been discussing. Found a neat fix: Instead of: Try this: Why it's cool: Bypasses node_modules tweaks. |
Hello,
Before my question - thanks for taking time to publish and maintain this library. NPM has a large number of rate limiting libraries, and I've tested quite a few. Very few handle both request rate and concurrency as cleanly, which should always go hand in hand since most servers will either 500 when overloaded or expressly prevent too high a concurrency. We're using your package to limit requests to a 3rd party api, for both proxied client uses (portioned using your redis manager) and for maintenance tasks (which utilize the full rates) - except for the below issue, so far its been good.
While integrating your package, we found an immediate problem like to how you're using package dependencies as runtime types to detect the redis client used. We do not use ioredis, but have been forced to install this ourselves as a dependency in our node project as it will fail to compile w/o doing so.
offending code, '~/build/src/quota/redisQuotaManager.ts' lines 1-5:
From the above and its usages, it seems like you're using packages directly in a union type as a means of feature detection. If I may make a suggestion, maybe consider just creating a generic type definition with the methods you require, and inspect/validate that the unknown/provided redis-client has them instead. Using the packages directly this way seems a bit heavy... even if these were say bundled w/ node or some other ubiquitous dependency. Regardless of how its solved, I think the redis client dependencies are an issue that should be addressed.
Thanks again for all your efforts!
Jared D.
The text was updated successfully, but these errors were encountered: