Skip to content

types: compact receiver hovers via public aliases#3248

Merged
nkaradzhov merged 1 commit into
redis:masterfrom
nkaradzhov:compact-receivers
May 21, 2026
Merged

types: compact receiver hovers via public aliases#3248
nkaradzhov merged 1 commit into
redis:masterfrom
nkaradzhov:compact-receivers

Conversation

@nkaradzhov
Copy link
Copy Markdown
Collaborator

@nkaradzhov nkaradzhov commented Apr 22, 2026

Introduces public RedisDefault* aliases (Modules, Functions, Scripts, RESP=3, TypeMapping)
plus named RedisDefault{Client,ClientPool,Cluster,Sentinel}Type aliases.
Each create* function gains non-generic overloads that return
the named default type when no custom modules are supplied;
The generic overload is preserved (with named-alias defaults for F/S/RESP/TYPE_MAPPING)
so custom-M callers keep inferred types and RESP stays pinned at 3.

No visible performance implications for ts compilation

Before:
image
After:
image

--

Checklist

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

Note

Medium Risk
Type-level refactors in the public packages/redis surface and multi-command typing could change downstream TypeScript inference/hover output, but should not affect runtime behavior.

Overview
Improves public TypeScript aliases and inference for Redis Stack clients. The PR introduces a public RedisClientMultiCommandTyped alias (replacing an internal-only type) so multi/pipeline command chaining exposes cleaner, reusable typed signatures.

In packages/redis, default module typing is reworked so exported RedisClientType/RedisClientPoolType/RedisClusterType/RedisSentinelType always include RedisDefaultModules while still allowing callers to extend with custom modules. The createClient/createClientPool/createCluster/createSentinel generics are updated to default to empty custom modules and RESP=3, and their return types are cast to the new exported aliases.

Reviewed by Cursor Bugbot for commit 75ce623. Bugbot is set up for automated code reviews on this repo. Configure here.

@nkaradzhov nkaradzhov requested a review from PavelPashov April 22, 2026 12:15
@nkaradzhov nkaradzhov force-pushed the compact-receivers branch from 156694b to 97aaa29 Compare May 21, 2026 09:17
@nkaradzhov nkaradzhov marked this pull request as ready for review May 21, 2026 09:42
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 97aaa29. Configure here.

Comment thread packages/redis/index.ts Outdated
Comment thread packages/redis/index.ts Outdated

export function createClientPool(): RedisDefaultClientPoolType;
export function createClientPool(
clientOptions: Omit<RedisClientOptions, "clientSideCache">,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this optional as they were before?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are optional, first overload doesnt have options. but nvm, im reverting to more simple state without overloads

Comment thread packages/redis/index.ts Outdated
RESP extends RespVersions = RedisDefaultRESP,
TYPE_MAPPING extends TypeMapping = RedisDefaultTypeMapping
>(
clientOptions: Omit<RedisClientOptions<M, F, S, RESP, TYPE_MAPPING>, "clientSideCache">,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this optional as they were before?

@nkaradzhov nkaradzhov force-pushed the compact-receivers branch from 97aaa29 to afc1452 Compare May 21, 2026 12:17
Move the RedisDefaultModules & M intersection into the Redis*Type alias
bodies and switch RedisDefaultModules to an interface so create*() hovers
as Redis*Type<…> instead of expanding to GenericRedis*Type<RedisDefaultModules
& M, …>. Finish the RESP=3 defaults master's Default Resp3 PR didn't reach
(Pool/Cluster + create* generics) and give every create* generic
`= {}` / `= 3` defaults.

@redis/client: rename and export InternalRedisClientMultiCommandType as
RedisClientMultiCommandTyped so chained multi hovers stay named.
@nkaradzhov nkaradzhov force-pushed the compact-receivers branch from afc1452 to 75ce623 Compare May 21, 2026 12:33
@nkaradzhov nkaradzhov merged commit f64538b into redis:master May 21, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants