Skip to content

Fix type-check regression from stricter match() inference#6122

Open
pawelangelow wants to merge 2 commits into
mainfrom
ci/fix-typechecks
Open

Fix type-check regression from stricter match() inference#6122
pawelangelow wants to merge 2 commits into
mainfrom
ci/fix-typechecks

Conversation

@pawelangelow

@pawelangelow pawelangelow commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

What

yarn type-check was failing on main after the typeorm 0.3.29 / socket.io
bumps tightened type inference, surfacing latent strict-null errors where
String.match() results (RegExpMatchArray | null) were destructured
directly:

TS2488: Type 'RegExpMatchArray | null' must have a 'Symbol.iterator'
method that returns an iterator.

  • Guard the match before destructuring in both affected API files —
    clusterCursor.ts (cursor parser) and cluster.ioredis.client.ts
    (NAT address parsing). host/port stay typed as string.
  • Refresh the api/desktop TS baselines: the same bumps regenerated
    api-client and lowered recorded error counts that were never updated.

These were the only two .match()-destructure sites in the API.


Note

Low Risk
Small null-safety guards in cluster cursor and NAT parsing; baseline JSON only affects recorded type-check debt, not runtime behavior for valid inputs.

Overview
Restores yarn type-check after stricter inference from dependency bumps (e.g. typeorm / socket.io) exposed TS2488 on direct destructuring of RegExpMatchArray | null.

Runtime/type fixes: parseClusterCursor and the ioredis cluster NAT map parser now assign match / natMatch, return or skip when there is no match, then destructure so host/port stay correctly narrowed.

Baselines: Updates redisinsight/api/.tscheck.rec.json (drops the fixed cluster.ioredis.client entry) and redisinsight/desktop/.tscheck.rec.json to reflect lower recorded error counts after regenerated api-client and related typing changes—not new product logic.

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

@pawelangelow pawelangelow self-assigned this Jun 27, 2026
@pawelangelow pawelangelow requested a review from a team as a code owner June 27, 2026 05:57
@jit-ci

jit-ci Bot commented Jun 27, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Code Coverage - Integration Tests

Status Category Percentage Covered / Total
🟡 Statements 79.06% 18008/22776
🟡 Branches 61.87% 8374/13533
🟡 Functions 66.85% 2447/3660
🟡 Lines 78.67% 16946/21540

`address.match()` returns `RegExpMatchArray | null`, but the result was
destructured directly. Recent dependency bumps (typeorm, socket.io)
tightened type inference and surfaced this as a new strict-null error
(TS2488), breaking `yarn type-check` on main.

Guard the match before destructuring, keeping `host`/`port` typed as
`string`. Also refresh the api/desktop TS baselines: the same bumps
regenerated `api-client`, lowering recorded error counts that were never
updated on main.
`natAddressString.match()` returns `RegExpMatchArray | null`, but was
destructured directly. The typeorm 0.3.29 bump tightened inference and
surfaced this as a strict-null TS2488 — caught by CI after the matching
baseline entry had been removed without the code fix.

@valkirilov valkirilov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

note: Maybe we should enable the type-check job to run on Dependabot PRs, because this is why I missed that regression :/

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