Repository navigation
fix(compiler): keep plain overload signatures non-ambient in the virtual TSX - #746
Merged
Merged
Conversation
…ual TSX esrap <2.3.2 printed `declare` on every bodyless function declaration, so a plain overload pair next to its implementation typechecked as TS2384 in the editor and under tsrx-tsc, on source that compiles and runs fine. Raise the esrap floor to ^2.3.2, which guards the modifier on the authored flag, and pin the contract with a volar regression test that runs the real TypeScript checker over the virtual TSX. Fixes octanejs#736 Co-authored-by: Cursor <[email protected]>
trueadm
marked this pull request as ready for review
August 12, 2026 22:23
…declare Co-authored-by: Cursor <[email protected]> # Conflicts: # pnpm-lock.yaml
3 of 6 tasks
Collaborator
|
i'm looking into the flaky tests in #752 |
Collaborator
I'll leave this PR to you then |
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.
Summary
Fixes #736.
octane/compiler/volaremitted every bodyless function declaration asdeclare function …, including plain TypeScript overload signatures. Theimplementation signature stayed non-ambient, so TypeScript rejected the pair
with TS2384 ("Overload signatures must all be ambient or non-ambient") in the
editor and under
tsrx-tsc, on source that compiles and runs fine.The root cause was esrap's
TSDeclareFunctionprinter writingdeclareunconditionally instead of reading
node.declare. esrap 2.3.2 guards themodifier on the authored flag, so this PR raises the workspace esrap floor
from
^2.3.0to^2.3.2(catalog, overrides, and theesrap_commonanchor)and adds a volar regression test.
The test compiles a
.tsrxfixture containing an overload pair, an authoredambient
declare function, and a component using them, then runs the realTypeScript checker over the virtual TSX and asserts zero diagnostics. The
oracle covers both directions: overloads wrongly made ambient report TS2384,
and an authored
declarewrongly dropped reports TS2391.A changeset on the
patchtrack is included, since the publishedoctanepackage's dependency floor changes and the fix is consumer-visible.
After merging current
main,pnpm syncrefreshed the generated React-parity lockfile hashes and eval-corpus manifest for the new lockfile; those deterministic outputs are included.Not addressed here: the adjacent
TSDeclareMethodcrash noted in #736 (throwsout of the mapping walker before any TSX is produced) lives in
@tsrx/coreand still reproduces on 0.1.56; it needs an upstream fix.
CI follow-up: the required React-parity shard exposed a pre-existing timing race in the generated Syntax Highlighter loading-state adaptation. The test now holds
loadLanguage()on a controlled pending promise, waits until loading has actually started, and then snapshots the plain-text fallback, so parity-wide runner load cannot race the oracle. The generated parity evidence hashes are refreshed.Validation
pnpm format:checkpnpm typecheckpnpm sync(rerun produced no remaining diff)vitest run packages/octane/tests/compiler/volar.test.ts --reporter=verbose(15/15)pnpm test: all prechecks passed and 20,944/20,945 tests passed; one unrelated browser-only Doom loading-state poll was transientvitest run --project doom-browser playground/octane/tests/doom/doom-production.test.ts --reporter=verbose --silent=false(7/7)pnpm react-parity:check --shard 2/3(stable: 5,345 cases; canary: 5,413 cases)The original-head compiler validation also passed
vitest run --project octane(6,791 tests),vitest run --project octane-prod(5,641 tests), andvitest run packages/octane/tests/compiler/(1,150 tests).Provenance
agent-authored)Note
Low Risk
Scoped dependency bump on the TSX printer with a focused compiler test; remaining diff is generated hashes and a test-only flake fix, not runtime product logic.
Overview
Raises the workspace esrap floor from
^2.3.0to^2.3.2so bodyless overload signatures in the Volar virtual TSX stay non-ambient while authoreddeclare functionstill printsdeclare, fixing false TS2384 in the editor andtsrx-tsc(#736).Adds a Volar regression test that typechecks compiled output with overloads plus an ambient declaration and expects zero diagnostics. Includes an octane patch changeset and refreshed lockfile hashes across react-parity audits and the eval train manifest after
pnpm sync.Separately stabilizes the generated Syntax Highlighter async loading-state parity test by mocking
loadLanguageas pending and waiting for the load to start before snapshotting, with updated parity audit hashes for that package.Reviewed by Cursor Bugbot for commit 3a8a245. Bugbot is set up for automated code reviews on this repo. Configure here.