Skip to content

fix(types): export ScanStreamOptions, RedisStatus and ClusterStatus - #2158

Merged
PavelPashov merged 1 commit into
redis:mainfrom
milcho0604:fix/export-public-types
Jul 30, 2026
Merged

PavelPashov merged 1 commit into
redis:mainfrom
milcho0604:fix/export-public-types

Conversation

@milcho0604

@milcho0604 milcho0604 commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Three types that describe the public API are not exported, so consumers can't name them and end up re-deriving them with Parameters<...> / ReturnType<...> or widening to something looser.

type where it shows up in the public API
ScanStreamOptions the options parameter of scanStream(), sscanStream(), hscanStream(), zscanStream() and their Buffer variants — 14 public methods across Redis and Cluster
RedisStatus the type of the public status property, and of the event names accepted by the on() / once() overloads
ClusterStatus the type of Cluster's public status property

ScanStreamOptions was already exported from lib/types.ts and only needed re-exporting from lib/index.ts; the other two gain an export keyword. No runtime code is touched.

Not included: FlushQueueOptions is in the same situation but only appears in private flushQueue() and an internal DataHandledable method, so it doesn't look like public API.

Tests

test/typing/exports.test-d.ts imports the three names and checks them against the signatures they describe, so the exports can't be dropped or drift from their use sites without tsd failing. Verified by mutation:

  • removing the three re-export lines from lib/index.ts → tsd fails with 5 errors (has no exported member ... ×3, plus two "Parameter type X is not identical to argument type X");
  • removing only the export keyword from type RedisStatus → build fails with lib/index.ts(70,15): error TS2614;
  • restored → clean.

Verification

  • npm run test:tsd — passes.
  • npm run lint — rc=0, same 23 warnings as baseline, none in changed lines.
  • prettier --check — same 13 warnings as baseline; lib/cluster/index.ts is flagged on baseline too and the edited region is byte-identical to prettier's output.
  • npm run test:js against docker:setup (single + cluster, both healthy) — 2545 passing, 34 pending, 6 failing. The six are georadiusbymember / georadiusbymember_ro ("returns the anchor member within a zero radius", RESP2/legacy + RESP3/legacy + RESP3/resp3). They reproduce identically on unmodified main with this change stashed, so they're pre-existing and unrelated to this PR.

Related: #1880 asked for RedisStatus to be exported; it was closed automatically as stale, with no maintainer decision on it.


Note

Low Risk
Type-only surface area with no runtime changes; risk is limited to accidental export removal or type drift, which tsd guards against.

Overview
Exports three public API types so TypeScript consumers can import them by name instead of using Parameters<...> / ReturnType<...>.

ScanStreamOptions is re-exported from the package entry (lib/index.ts); it already existed in lib/types.ts. RedisStatus and ClusterStatus are now exported from their defining modules (lib/Redis.ts, lib/cluster/index.ts) and re-exported from lib/index.ts. No runtime behavior changes.

Adds test/typing/exports.test-d.ts with tsd checks that these exports stay aligned with scanStream options, Redis.status, and Cluster.status.

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

These three types describe the public API but are not exported, so
consumers cannot name them and have to re-derive them with
Parameters<...>/ReturnType<...> or fall back to a wider type.

- ScanStreamOptions is the options parameter of scanStream(),
  sscanStream(), hscanStream(), zscanStream() and their Buffer
  variants, on both Redis and Cluster (14 public methods).
- RedisStatus is the type of the public 'status' property and of the
  event names accepted by the on()/once() overloads.
- ClusterStatus is the type of Cluster's public 'status' property.

ScanStreamOptions was already exported from lib/types.ts and only
needed re-exporting; the other two gain an export keyword. No runtime
code changes.

Adds test/typing/exports.test-d.ts, which imports the three names and
checks them against the signatures they describe, so the exports cannot
be dropped or drift from their use sites without failing tsd.

@PavelPashov PavelPashov left a comment

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.

Thank you for the contribution. LGTM

@PavelPashov
PavelPashov merged commit cf3bf71 into redis:main Jul 30, 2026
22 checks passed
github-actions Bot pushed a commit that referenced this pull request Jul 31, 2026
# [6.0.0](v5.11.1...v6.0.0) (2026-07-31)

* Add RESP3 ([#2127](#2127)) ([5d0862e](5d0862e))

### Bug Fixes

* clear stale socket timeout on reconnect ([#2148](#2148)) ([6455dbe](6455dbe))
* **cluster:** recreate stale connection on circular MOVED ([#2135](#2135)) ([08c8967](08c8967))
* **cluster:** validate MOVED slot to prevent Array.prototype pollution ([#2151](#2151)) ([9618206](9618206)), closes [#1267](#1267)
* **command:** serialize large integer arguments in decimal notation ([#2136](#2136)) ([09b8d04](09b8d04))
* **redis:** keep reconnecting when connection closes during client setup ([#2099](#2099)) ([#2123](#2123)) ([f9a66bc](f9a66bc))
* **sentinel:** preserve zero preferred slave priority ([#2129](#2129)) ([a3f9f2d](a3f9f2d))
* **tracing:** redact values for GETSET and PSETEX ([#2134](#2134)) ([832765d](832765d))
* **types:** export ScanStreamOptions, RedisStatus and ClusterStatus ([#2158](#2158)) ([cf3bf71](cf3bf71))

### Features

* add LMOVEM and BLMOVEM command support ([#2144](#2144)) ([c26af46](c26af46))
* add Redis 8.10 set cardinality commands ([#2143](#2143)) ([301099b](301099b))
* himport managed fieldsets ([#2159](#2159)) ([729f174](729f174))
* improve default connection resilience ([#2160](#2160)) ([6d0716e](6d0716e))
* support MAXCOUNT and MAXSIZE for stream reads ([#2142](#2142)) ([ae5e41b](ae5e41b))

### BREAKING CHANGES

* ioredis now requires Node.js 20 or newer and uses RESP3 by default. Set `protocol: 2` to retain the v5 wire protocol.
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants