Skip to content
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

@const can be inside an if block as well #1470

Closed
stephane-vanraes opened this issue May 3, 2022 · 6 comments
Closed

@const can be inside an if block as well #1470

stephane-vanraes opened this issue May 3, 2022 · 6 comments
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.

Comments

@stephane-vanraes
Copy link
Contributor

Describe the bug

Since Svelte 3.48 @const is allowed to be inside an #if as well, the extension however still complains about this.

image

Reproduction

{#if true}
  {@const test = 123}
{/if}

Expected behaviour

Code above is not marked as an error.

System Info

  • OS: [Windows]
  • IDE: [VSCode]
  • Svelte for Vs Code: [v105.16.0]

Which package is the issue about?

Svelte for VS Code

Additional Information, eg. Screenshots

No response

@stephane-vanraes stephane-vanraes added the bug Something isn't working label May 3, 2022
@lacherogwu
Copy link

Same here 😄
Screen Shot 2022-05-03 at 10 52 26

@stephane-vanraes
Copy link
Contributor Author

I suppose this is just a matter of bumping the svelte version in the extension.

@jasonlyu123
Copy link
Member

We might need some time with this one. It's tricky to implement this into the svelte2tsx transformation for type check.

@dummdidumm
Copy link
Member

I guess this is easier for the new transformation. Should we only implement it for that one, which also will give us more users for it, which should help get more feedback before switching?

@dummdidumm
Copy link
Member

dummdidumm commented May 7, 2022

Turns out this already works without modifications for the new transformation, we just need to bump the Svelte version 👍

dummdidumm pushed a commit to dummdidumm/language-tools that referenced this issue May 7, 2022
support for const in if blocks in new transformation
sveltejs#1470
@jasonlyu123
Copy link
Member

I have some ideas about how to do this in the old transformation but haven't finished it yet. I can add a PR later. Don't have to wait for it though I also think we can get the new transformation supported first.

jasonlyu123 pushed a commit to jasonlyu123/language-tools that referenced this issue May 8, 2022
support for const in if blocks in new transformation
sveltejs#1470
dummdidumm added a commit that referenced this issue May 10, 2022
support for const in if blocks in new transformation
#1470
@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

No branches or pull requests

4 participants