Ability to create a KeyvRedis with an existing Redis instance in Typescript
talzion12 opened this issue · 2 comments
talzion12 commented
In the readme for keyv redis it says that a KeyvRedis
can be constructed as follows:
const KeyvRedis = require('@keyvhq/redis')
const Keyv = require('@keyvhq/core')
const Redis = require('ioredis')
const redis = new Redis('redis://user:pass@localhost:6379')
const keyv = new Keyv({ store: new KeyvRedis(redis) })
However this code doesn't compile with Typescript, nor should it according to index.d.ts.
Looking at the JS I think the code does work although I didn't test this. IMO the only change that is needed is to add a constructor to the index.d.ts file. In fact there seem to be 2 identical constructors in index.d.ts, I assume one of them was supposed to be the constructor to create a KeyvRedis
with a Redis
instance.
Kikobeats commented
Thanks for reporting; Can you make a PR for this? 🙂
talzion12 commented
Sure.