svelte-intellij icon indicating copy to clipboard operation
svelte-intellij copied to clipboard

Variables created in reactive statements are marked as unresolved

Open TheOnlyTails opened this issue 2 years ago • 10 comments

When I create a variable in a reactive statement like so:

let count = 0;
$: doubled = count * 2;

The result is the following: image In both the declaration site and any usage, the reactive variable is marked as unresolved.

TheOnlyTails avatar Sep 18 '21 14:09 TheOnlyTails

I have the same problem in Pycharm Pro 2021.3 obraz

rafrafek avatar Dec 07 '21 10:12 rafrafek

A workaround is to split the declaration and assignment:

let count = 0;

let doubled;
$: doubled = count * 2;

he1d1 avatar Dec 22 '21 22:12 he1d1

A workaround is to split the declaration and assignment:

let count = 0;

let doubled;
$: doubled = count * 2;

Thanks I was banging my head against the wall with this, until eventually I had to remove the lang="ts" and fall back to plain JavaScript.

AnthoniG avatar Dec 23 '21 09:12 AnthoniG

Folks, I tried to reproduce this across versions and reactive declarations always work for me no matter if in JS or TS script. I'll need a reproduction project for this bug, I'm afraid.

tomblachut avatar Dec 23 '21 15:12 tomblachut

Folks, I tried to reproduce this across versions and reactive declarations always work for me no matter if in JS or TS script. I'll need a reproduction project for this bug, I'm afraid.

This usually happens after you shut the IDE completely and reopen it

he1d1 avatar Jan 11 '22 11:01 he1d1

Folks, I found the root cause, fix will be released soon

tomblachut avatar Feb 17 '22 17:02 tomblachut

Awesome, thank you!

TheOnlyTails avatar Feb 17 '22 19:02 TheOnlyTails

Was there any regression recently? I'm having this issue in PhpStorm in fresh project

Happens inconsistently, some places work ok, some not

image

AndrewKirkovski avatar Aug 17 '22 18:08 AndrewKirkovski

I'm actually getting this too with the new SvelteKit changes:

<script lang="ts">
  export let data;
  $: ({ posts } = data)
  //    ^^^^^ -> error here, posts cannot be found
</script>

TheOnlyTails avatar Aug 17 '22 19:08 TheOnlyTails

Folks, I'm assuming this is the 2022.2? Maybe something regressed in the core JS code, need to check

tomblachut avatar Aug 19 '22 08:08 tomblachut