-
-
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
Allow @const
inside #key
#15376
Comments
I think it could make sense, and if you feel adventurous and want to try a PR the fix should be, like you said, to just add an extra condition in the const tag visitor. If you decide to so please make sure to also add a test in the Otherwise I'll see if I can open the PR myself later. |
Seems simple enough, I will give it a shot! |
That's the folder...you need to create a new folder in the samples folder above that file with an unique name and an input.svelte file in it (or main.svelte I can never remember)...you can just take inspiration from the other folders |
Describe the problem
Hi !
After discussion on the discord, the question remains. Why isn't it possible to use
@const
inside#key
?When
@const
is the first child of a#key
, the compile gives us the "const_tag_invalid_placement". Which list every other#
keywords, so why not#key
?This is not a big deal. there are multiple workaround for that.
<svelte:boundary>
for inside loops when a parameter is necessary$derived
but have to create an unused varSmall playground for reproduction and workarounds.
I don't know if this is just a missing feature/bug or if there are more implications that I am not aware of.
First time issue here, feel free to correct me I missed something, or close the issue if it's an intended behaviour.
I am not familiar enough to create a PR for this (As I don't know if editing the Visitor ConstTag is enough).
Describe the proposed solution
Allow
@const
inside#key
as it make sense to create a template variable inside a reactive scope.Importance
nice to have
The text was updated successfully, but these errors were encountered: