-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow ts casts in bindings #10181
Conversation
🦋 Changeset detectedLatest commit: 1a50e1f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There's an |
turns out the place that marks the binding as reassigned and mutated
would also need to be updated, I think it makes sense to unwrap everything right after parse then |
@@ -270,6 +272,9 @@ function _extract_paths(assignments = [], param, expression, update_expression) | |||
* The Acorn TS plugin defines `foo!` as a `TSNonNullExpression` node, and | |||
* `foo as Bar` as a `TSAsExpression` node. This function unwraps those. | |||
* | |||
* We can't just remove the typescript AST nodes in the parser stage because subsequent | |||
* parsing would fail, since AST start/end nodes would point at the wrong positions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried removing all AST nodes right after parsing in a post-process step, but it failed because of this - if you have an idea how to solve this, I'm all ears
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's for removing it during parsing right? We could do one pass after the whole file is parsed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mhm maybe. I removed it after an expression/the script tag was parsed, but doing it after the whole thing is parsed could maybe work.. would you mind trying it out?
fix #10179
Svelte 5 rewrite
Please note that the Svelte codebase is currently being rewritten for Svelte 5. Changes should target Svelte 5, which lives on the default branch (
main
).If your PR concerns Svelte 4 (including updates to svelte.dev.docs), please ensure the base branch is
svelte-4
and notmain
.Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint