feat(redis): support ioredis v6 - #19
Open
mattstrayer wants to merge 1 commit into
Open
Conversation
Widen the ioredis peer range to `^5.3.2 || ^6.0.0` so package managers stop installing a private second copy when another dependency needs v6. Type the `connection` option as a structural `RedisConnection` interface that lists the five commands the driver calls, instead of the ioredis `Redis` class. This accepts a v5 client, a v6 client, a `Redis<"resp3">` client and a `Cluster` instance, and no longer depends on the class shape. Closes Julien-R44#18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #18
Problem
@verrou/corelimits theioredispeer range to^5.3.2. ioredis 6.0.0 is nowlatest. When another dependency needs v6, pnpm installs a private second copy of v5 for verrou. The two copies have different type identities, so passing the app's v6 client toredisStore({ connection })fails typecheck.Changes
^5.3.2 || ^6.0.0.connectionoption as a structuralRedisConnectioninterface that lists the five commands the driver calls (set,setnx,eval,del,get). It replaces the import of the ioredisRedisclass. A v5 client, a v6 client, aRedis<"resp3">client and aClusterinstance all satisfy it, and the option no longer depends on the class shape.RedisandClustermatchRedisConnection.The devDependency stays at
^5.8.2, so the lockfile is untouched.Verification
With ioredis 5.8.2 installed:
tsc --noEmit: no errorseslint .: no errorspnpm build: passestests/drivers/redis.spec.tsagainst Redis 8: 27 tests passWith ioredis 6.0.0 installed in place of 5.8.2:
tsc --noEmit: no errorsRedis<'resp3'>is assignable toRedisConnection