Skip to content

fix(tsrx): patch @tsrx/core to map TS parameter properties and bodyless methods - #1276

Merged
domgan-oai merged 1 commit into
mainfrom
fix/tsrx-class-ts-member-mappings
Sep 23, 2026
Merged

domgan-oai merged 1 commit into
mainfrom
fix/tsrx-class-ts-member-mappings

Conversation

@trueadm

@trueadm trueadm commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Why

  • pnpm typecheck:files failed on any .tsrx file with, for example, constructor(private readonly start: number, public step = 1) {}. tsrx-tsc logged Unhandled AST node type in mapping walker: TSParameterProperty, fell back to raw text, and reported bogus TS1144/TS1005/TS1128.
  • Probing other class-member TS shapes found TSDeclareMethod failing the same way. The parser emits it for overload signatures (including constructor overloads), abstract m(): T;, and optional m?(): T;. Abstract properties, accessor fields, and index signatures already worked. The parser never emits TSAbstract* node types.
  • Fixing the walker exposed a printer bug: esrap drops override on parameter properties, so constructor(override readonly n: number) failed with TS4115 under noImplicitOverride.
  • @tsrx/core is published from tsrx-org/tsrx, and its main (0.2.4) still has both bugs. The upstream fix is fix(core): map TS parameter properties and bodyless class methods tsrx-org/tsrx#143. This patch should be dropped once a release containing it is adopted.

Changes

  • patches/@[email protected] and the pnpm-workspace.yaml patchedDependencies entry, with a removal note.
  • pnpm-lock.yaml: only the @tsrx/core patch-hash changes. pnpm patch-commit also pruned ~1,900 unrelated orphan lines, so I rebuilt the lockfile without that churn. pnpm install --frozen-lockfile accepts it.
  • packages/octane/tests/compiler/volar.test.ts: new regression test. It compiles a .tsrx file with parameter properties, override, abstract members, overloads, and an optional method. It asserts that parameter names map back to source and that the virtual TSX has zero diagnostics under strict and noImplicitOverride. Without the patch it fails with the original walker error.
  • Audit ledgers and the octane-evals manifest: lockfile-hash refreshes generated by pnpm sync.

Validation

  • pnpm format:check
  • pnpm typecheck
  • pnpm test: not run in full.
  • targeted tests: packages/octane/tests/compiler/volar.test.ts (30/30 pass). The new test fails against unpatched @tsrx/core.
  • pnpm typecheck:files on the original repro plus overload, abstract, and optional-method shapes is clean, and a planted TS2322 is reported on the correct line.

Risk / follow-ups

  • Tooling-only: the patch affects this workspace's tsrx-tsc and editor mappings. Published packages ship .tsrx source and are unaffected, so there is no changeset.
  • Once a released @tsrx/core includes the fix, parameter-property coverage for the in-progress TypeScript runtime-lowering work can move from compiled source strings into checked .tsrx fixtures.
  • esrap also drops parameter decorators (@dec() x). That only matters with legacy experimentalDecorators and is not addressed here.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

Low Risk
Tooling-only change to local @tsrx/core patching and audit/eval hash metadata; no runtime package behavior change for published Octane consumers.

Overview
Adds a pnpm patch on @tsrx/[email protected] (upstream tsrx-org/tsrx#143) so the TSRX→virtual TSX mapping walker handles constructor parameter properties and bodyless methods (TSParameterProperty, TSDeclareMethod), including preserving override on parameters for noImplicitOverride. That stops tsrx-tsc/editor tooling from falling back to raw text and emitting bogus parse errors on real .tsrx class syntax.

A new volar.test.ts regression compiles a fixture with parameter properties, abstract/optional/overloaded members, checks source mappings, and asserts zero TypeScript diagnostics on the generated TSX.

Lockfile-driven metadata is refreshed everywhere it is pinned: lockfileSha256 in package audit/react-parity.json files and overlayLockfileHash on user-apps-v1 eval manifest rows (same new workspace lock hash).

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

…ss methods

tsrx-tsc threw "Unhandled AST node type in mapping walker" on constructor
parameter properties (TSParameterProperty) and bodyless class methods
(TSDeclareMethod: overloads, abstract, optional), fell back to raw text,
and reported bogus TS1144/TS1005/TS1128. The printer also dropped
`override` on parameter properties. Carry the upstream fix
(tsrx-org/tsrx#143) as a pnpm patch until a release ships it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm marked this pull request as ready for review September 23, 2026 08:51
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Sep 23, 2026
@domgan-oai
domgan-oai merged commit 82c2c64 into main Sep 23, 2026
47 of 50 checks passed
@domgan-oai
domgan-oai deleted the fix/tsrx-class-ts-member-mappings branch September 23, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants