fix(redis): accept inferred client types in SearchIndex; reject RESP=3#29
Merged
Conversation
06ecd34 to
9633c3b
Compare
ajGingrich
added a commit
that referenced
this pull request
May 18, 2026
RESP=3 is rejected at SearchIndex construction (see PR #29), so the Map-row branch in aggregate() is purely about the RESP=2 Map type- mapping opt-in, not about RESP3. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Issue:
Calling new SearchIndex(schema, client) previously failed to compile
when client came directly from createClient or createCluster without
an explicit type annotation.
The inferred client's RESP generic resolved to the 2 | 3 union,
which forces callers to manually pin RESP: 2 by doing createClient({ ..., RESP: 2 })
to satisfy TypeScript.
Fix:
- new SearchIndex(schema, client) now compiles when client is the
inferred return of createClient/createCluster, with no explicit
type annotation required at the call site.
- throw a RedisVLError at SearchIndex construction for Clients configured with RESP: 3
- Add unit tests for the protocol guard and the RESP=3 rejection
9633c3b to
ee52eb4
Compare
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.
Issue:
Calling
new SearchIndex(schema, client)previously had TS complaining when client came directly fromcreateClientorcreateClusterwithout an explicit type annotation.The inferred client's RESP generic resolved to the 2 | 3 union, which forces callers to manually pin
RESP: 2by doingcreateClient({ ..., RESP: 2 })to satisfy TypeScript.Fix:
new SearchIndex(schema, client)now compiles when client is the inferred return ofcreateClient/createCluster, with no explicit type annotation required at the call site.RedisVLErroratSearchIndexconstruction for Clients configured withRESP: 3RESP=3rejection