Repository navigation
feat: remove lazy destructuring (RFC #106) - #110
Merged
Merged
Conversation
Remove the `&{ ... }` / `&[ ... ]` lazy binding patterns per RFC #106
(#106). The parser plugin no
longer recognizes the sigils in binding, assignment, loop-header, or
statement positions, so they fall through to Acorn's ordinary syntax
errors. Delete `transform/lazy.js`, the pre-walk id allocation and the
post-lowering rewrite in the JSX transform, the `lazy` pattern flag, the
`lazy` / `lazy_fallback` binding kinds, the lazy AST metadata, the
`__lazyN` hover rewrites and param binding mappings in the source-map
segments, the `UNSUPPORTED_LAZY_ASSIGNMENT_POSITION` diagnostic, and the
public lazy exports. Replace the lazy test suites with negative parse
tests and plain-destructuring mapping coverage.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
…lid, and Vue Follow-up to the core removal in RFC #106 (#106). Delete the lazy lowering tests, rewrite incidental uses to plain destructuring, keep the runtime rendering tests as plain-destructuring coverage, and add one compile test per target asserting the removed syntax is rejected. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Per RFC #106 (#106): stop printing `&` before patterns in the Prettier plugin, delete the `tsrx/no-lazy-destructuring-in-modules` ESLint rule and its config entries, drop the lazy example from the ESLint parser README, and remove the lazy destructuring entry from the MCP docs index and server prompt. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Per RFC #106 (#106): drop the `lazy_object_pattern` / `lazy_array_pattern` rules and regenerate the Tree-sitter parser, remove the `&` operator captures from the Tree-sitter, Zed, and Neovim highlight queries, and delete the `&`-prefixed destructuring rules from the TextMate grammar and its generated tmbundle. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Per RFC #106 (#106): drop the feature from the README feature list, the `llms.txt` guide and quick reference, the specification (section 4.5 and its grammar productions, with later sections renumbered), the features and index pages, and migrate the Ripple compiler demo to `track()` with `.value` reads. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
This PR is too large for Bugbot to review. It changes 100,448 lines and 4,074,340 characters. Split the change into smaller pull requests to get a review. |
Contributor
Author
|
reviewing it with Astra since bugbot refused. |
The `checkLValPattern` override was introduced alongside lazy patterns but
fixes a general acorn-typescript gap: `[{ a } as T] = arr` otherwise fails
with "Assigning to rvalue". Its only coverage used `&{ ... }` and was
removed with the feature, so add a plain-TypeScript regression test.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Its last in-repo callers were the Solid and Vue `<Dynamic>` runtime wrappers, which were replaced by compiler lowering in #1241. Props are plain objects, so the getter-forwarding object has no remaining purpose; a `const { is, ...rest } = props` spread covers the same need. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Nothing in this repository consumed them, and the lowering they produced emitted Ripple runtime names (`_$_.exclude_from_object`, `_$_.array_slice`) from the target-neutral core. The Ripple compiler is the only consumer and takes ownership of that helper. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Contributor
Author
|
Ok, reviewed with Astra, all good now. |
trueadm
approved these changes
Sep 14, 2026
trueadm
left a comment
Contributor
There was a problem hiding this comment.
We'll need to create a TSRX blog post for this and update SWC and the OXC ports too.
This was referenced Sep 14, 2026
Announce the RFC #106 removal (#106): why the feature existed, what was wrong with it, what to write instead per target, and the mechanical migration. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Contributor
Author
I created issues for OXC and Yuku (tsrx-org/oxc and tsrx-org/yuku) but SWC I think only does the TSX printing of the final ast, so lazy destructure doesn't appear there. |
This was referenced Sep 14, 2026
leonidaz
added a commit
that referenced
this pull request
Sep 14, 2026
…d grammar rev (#111) * chore(release): allow minor bumps, upgrade changesets to 3.x, sync Zed grammar rev Switch the RFC #106 changesets from PR #110 to `minor` and upgrade `@changesets/cli` to ^3.0.2 so that peer-dependent packages are bumped by `patch` instead of `major`. Under 2.x the `@tsrx/typescript-plugin` peer dependencies on the target compilers would have pushed its fixed group (eslint-parser, eslint-plugin, language-server, prettier-plugin) to 1.0.0. - `scripts/check-changesets.js` now rejects only `major`; CI step names and the RuleSync bump policy are updated to match. - Point `.changeset/config.json` `$schema` at config 4.0.0. - Sync the Zed grammar rev to dcc0283 so the extension builds the tree-sitter grammar without lazy destructuring. - Fix `sync-zed-grammar-rev.js` exiting the parent version script early on the already-synced path, which skipped the Zed Cargo.toml version update. Co-Authored-By: Claude Fable 5.1 <[email protected]> * ci: migrate to changesets/action@v2 for the Changesets 3 CLI Changesets CLI 3 no longer prints the `New tag:` lines that changesets/action@v1 parsed to find published packages, so v1 would publish to npm but never create git tags or GitHub releases. v2 reads the CLI's `CHANGESETS_OUTPUT` file instead and validates that the project uses CLI 3. - Rename inputs (`version` -> `version-script`, `publish` -> `publish-script`, `commit` -> `commit-message`, `title` -> `pr-title`) and pass the token through the `github-token` input, which v2 requires. - Keep `GITHUB_TOKEN` in the release workflow only, where `@changesets/changelog-github` reads it. - v2 dropped writing `.npmrc` from `NPM_TOKEN`, so the bootstrap workflow now authenticates through `actions/setup-node` `registry-url` and `NODE_AUTH_TOKEN`. Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
leonidaz
added a commit
that referenced
this pull request
Sep 14, 2026
…113) These helpers only backed lazy destructuring and the `extractPaths` lowering, both removed in #110. Their last consumer, the Ripple compiler, now lowers rest and default patterns with native destructuring (Ripple-TS/ripple#1472), so nothing emits or imports them any more. Co-authored-by: Claude Fable 5.1 <[email protected]>
thejackshelton
added a commit
to tsrx-org/yuku
that referenced
this pull request
Sep 15, 2026
tsrx removed lazy destructuring (`&{ ... }` / `&[ ... ]`) from the language
in tsrx-org/tsrx#110. `&` directly before `{` or `[` in a binding,
assignment, loop-header, or statement position is now a plain syntax error
from the ordinary parser, as in TypeScript. `a & { b: 1 }` and `x & [1]`
are still bitwise AND. Ordinary destructuring is the only destructuring.
- delete src/dialect/patterns.zig and the lazy_assignment_pattern,
binding_pattern, and can_start_binding parser hooks; the seam falls
through to its ordinary parser on its own
- drop the ArrayPattern/ObjectPattern overlay records from the schema and
ABI and regenerate the decoders (record tags renumber to 183/184/185)
- stop printing the `&` prefix in codegen
- delete the lazy fixtures, snapshots, benchmark pairs, and tests; add the
six reference negative cases and bitwise-AND positives to m4.zig and
m4.test.ts; de-lazy the control-flow-try fixture
- docs: README parse list, the dialect page, and Limitations
Closes #2
This was referenced Sep 25, 2026
[Bug]: tsrx-core: Parser rejects an optional binding pattern parameter in an overload signature
#557
Closed
leonidaz
added a commit
that referenced
this pull request
Sep 25, 2026
…declarations, and decorators on a rest parameter (#194, #533, #564) (#614) * fix(core): parse anonymous and decorated default-exported classes as declarations, and decorators on a rest parameter (#194, #533, #564) Four parser bugs caused upstream in @sveltejs/acorn-typescript 1.0.13, each worked around by overriding the responsible method in TSRXPlugin, marked `UPSTREAM(sveltejs/acorn-typescript#<n>)`, with the AST of the upstream fix: - #194: `parseClassId` skips `implements` wherever the class name is optional, with `id: null`, and `parseExportDefaultDeclaration` parses `export default abstract class` with an optional name. Upstream: sveltejs/acorn-typescript#113 (also #110 for the abstract part). - #533: `parseExportDefaultDeclaration` reads the decorators after `export default` and parses `class` or `abstract class` as a declaration, so `export default @dec class B {}` is a ClassDeclaration that binds `B` and `export default @dec abstract class {}` parses. Node ranges don't change. Upstream: sveltejs/acorn-typescript#124. - #533 (last row): `parseDecorators` checks that decorators written before `export` are followed by an exported class, and reports them otherwise with the existing "Leading decorators must be attached to a class declaration." error, instead of dropping them or moving them onto a class expression. Upstream: sveltejs/acorn-typescript#125. - #564: `parseAssignableListItem` reads the decorators before `...` and hangs them off the RestElement, as typescript-estree does. Like any parameter decorator this is not an error: TypeScript's checker decides (TS1206 unless experimentalDecorators). Upstream: sveltejs/acorn-typescript#126. tsrx-prettier-plugin no longer retypes a decorated default-exported class expression as a declaration, which the parser now produces. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(core): don't let an at-sign construct after `export` pass for a decorator (#533) The check for decorators written before `export` deferred to the later decorator check when `@` followed `export` or `export default`. An at-sign construct there (`@if (a) { … }`, `@{ … }`) is an expression, not a decorator, so nothing checked the leading decorators, and the next class took them: `@dec export default @if (a) { … }` followed by `class A {}` decorated `A`. Report them at the construct instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Sep 25, 2026
This branch was successfully deployed
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.
Implements RFC #106: Remove lazy destructuring for everything owned by this repository. The
@tsrx/ripplecompiler and the Ripple runtime types live in the Ripple repository and will be migrated separately once this lands.What changes
&{ ... }and&[ ... ]are no longer part of the TSRX language.&followed by{or[in a binding, assignment, loop-header, or statement position is a plain syntax error, exactly as in TypeScript. There is no replacement syntax: every destructure is an ordinary destructure, combining props is an ordinary spread, and reactive state is read through the target's own API.(&{ name }: Props)({ name }: Props)(&{ name }: Props) => <p>{name}</p>(props: Props) => <p>{props.name}</p>(orsplitProps)let &{ count } = statestate.count, orconst { count } = toRefs(state)andcount.valuelet &[count] = track(0); count++const count = track(0); count.value++@tsrx/core&{/&[binding-atom override, thelet &declaration detection, the expression-position pending-error tracking, thetoAssignable/checkExpressionErrorsoverrides, and the statement-level&[x] = expr;form.transform/lazy.js(the__lazyNmember-access rewrite), the pre-walk id allocation, and the post-lowering rewrite pass. The JSX transform now prints the lowered program directly.__lazyNhover rewrites andlazy_param_binding_mappings;AssignmentPatternmappings no longer special-case lazy targets.UNSUPPORTED_LAZY_ASSIGNMENT_POSITION, its validator, and the assignment-position analysis.lazyflag onObjectPattern/ArrayPattern, thelazy/lazy_fallbackbinding kinds,lazy_array_*binding metadata,lazy_id/has_lazy_descendants/has_lazy_var_loop_descendantsnode metadata,LazyPattern/LazyContext/LazyBinding, andDestructuringErrors.lazyBindingPos.createLazyContext,collectLazyBindings,collectLazyBindingsFromStatements,preallocateLazyIds,applyLazyTransforms,validateUnsupportedLazyAssignmentPosition, andTSRX_UNSUPPORTED_LAZY_ASSIGNMENT_POSITION_ERROR.Targets
React, Preact, Solid, and Vue had no lazy-specific compiler code beyond the shared pass. Their test suites drop the lazy lowering cases, keep the runtime tests as plain-destructuring coverage, and each gains a test asserting the removed syntax is rejected.
Runtime
No runtime helper existed for lazy destructuring itself. While auditing the runtime for helpers that only existed to combine or forward props, the unused
exclude_prop_from_objectlanguage helper (and its@tsrx/core/runtime/language-helpersre-export) is removed: its last in-repo callers were the Solid and Vue<Dynamic>runtime wrappers, replaced by compiler lowering in #1241, and with plain-object props aconst { is, ...rest } = propsspread covers the same need. Ref merging (normalize_spread_propsand friends) is unchanged since it is keyed on ref symbols.The core
extractPathsutility and itsDestructuredAssignmenttype are removed for the same reason: no in-repo consumer, and the lowering it emitted (_$_.exclude_from_object,_$_.array_slice) hard-coded Ripple runtime names inside the target-neutral core. The Ripple compiler is its only consumer and takes ownership of it.Tooling and editors
&before patterns.tsrx/no-lazy-destructuring-in-modulesis removed from@tsrx/eslint-pluginand itsrecommended/strictconfigs.lazy_object_pattern/lazy_array_pattern(parser regenerated); the Tree-sitter, Zed, and Neovim highlight queries drop the&captures.&-prefixed destructuring rules; the tmbundle is regenerated.Docs
README,
packages/tsrx/README.md,llms.txt, the specification page (section 4.5 removed, 4.6–4.7 renumbered to 4.5–4.6), the features and index pages, and the ESLint parser README are updated. The Ripple-powered compiler demo on the website is migrated totrack()with.value. A blog post, "Removing lazy destructuring" at/blog/removing-lazy-destructuring, announces the change.Validation
pnpm test: 95 files, 3860 passed, 33 skipped (pre-existing conditional skips)pnpm typecheck: cleanpnpm changeset:check: cleanpnpm format:check: clean apart from gitignored IntelliJ sandbox artifactstree-sitter test: 69/69Follow-ups (not in this PR)
@tsrx/ripple, simplifyTracked/Derived/WritableDerivedto their base shapes, drop the[0]/[1]tracked-index errors, and migrate Ripple docs and tests to.value.@tsrx/ripple, theTrackedtypes,exclude_prop_from_objectin the serverDynamic, owningextractPaths) are tracked in Follow-ups for tsrx RFC #106: remove lazy destructuring and Ripple-only core helpers Ripple-TS/ripple#1471.@tsrx/oxc: Remove lazy destructuring (tsrx RFC #106 parity) oxc#85@tsrx/yuku: Remove lazy destructuring (tsrx RFC #106 parity) yuku#2🤖 Generated with Claude Code