Skip to content

Fix recordCommitLatency parameter type for the widened commitResolution union#1899

Merged
kriszyp merged 1 commit into
mainfrom
kris/fix-commit-latency-param-type
Jul 22, 2026
Merged

Fix recordCommitLatency parameter type for the widened commitResolution union#1899
kriszyp merged 1 commit into
mainfrom
kris/fix-commit-latency-param-type

Conversation

@kriszyp

@kriszyp kriszyp commented Jul 22, 2026

Copy link
Copy Markdown
Member

Main currently has a TS2345 at resources/DatabaseTransaction.ts:413: 6e6d57ed8 widened commitResolution to Promise<number | void> | void for the LMDB-engine guard, but recordCommitLatency still declared Promise<void>.

The main build job tolerates tsc errors, but the Next.js adapter integration workflow builds harper with errors fatal — so this fails those checks on every PR (observed on #1898, all three Node versions).

The recorder only times settlement (fulfil or reject) and already thenable-guards, so it takes Promise<unknown> | void; the now-redundant as Promise<void> cast on transaction.commit() is removed with its stale comment. Type-only — no runtime change. tsc --noEmit -p tsconfig.build.json exits clean with this patch.

🤖 Generated with Claude Code (Opus 4.8)

…on union

6e6d57e widened commitResolution to Promise<number | void> | void for the
LMDB-engine guard, leaving the recordCommitLatency(commitResolution) call a
TS2345 on main. The recorder only times settlement and already guards for
thenables, so take Promise<unknown> | void; the now-unneeded commit() cast
goes with it. Type-only, no runtime change; unblocks the Next.js adapter CI
leg, which builds harper with tsc errors fatal.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kriszyp
kriszyp requested a review from cb1kenobi July 22, 2026 15:08
@claude

claude Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Reviewed; no blockers found.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates resources/DatabaseTransaction.ts to loosen the type of commitResolution in recordCommitLatency from Promise<void> to Promise<unknown> | void. This change allows for the removal of an explicit type cast (as Promise<void>) when assigning the result of transaction.commit(). No review comments were provided, and there is no additional feedback to offer.

@kriszyp

kriszyp commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

Note: #1898 now carries a minimal version of this fix on its branch (3bf19a9, Promise<void>Promise<unknown>) so its Next.js adapter CI legs can pass pre-merge. This PR remains the standalone main unblock (and additionally removes the now-redundant as Promise<void> cast). Whichever lands second rebases trivially. — Claude (Opus 4.8)

@kriszyp
kriszyp marked this pull request as ready for review July 22, 2026 15:24
@kriszyp
kriszyp merged commit 1da1c65 into main Jul 22, 2026
60 of 61 checks passed
@kriszyp
kriszyp deleted the kris/fix-commit-latency-param-type branch July 22, 2026 17:51
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.

1 participant