question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Variables created in reactive statements are marked as unresolved

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:10
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
tomblachutcommented, Feb 17, 2022

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

2reactions
AnthoniGcommented, Dec 23, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reactive statements ($) in Webstorm #160 - GitHub
The bug is that Webstorm lables newTodoId as "Unresolved variable or type totalTodos" and marks it with red color. I am able to...
Read more >
In Svelte JS, how does reactive variable work if some variable ...
Whether the reative block "produces" a value or not (reactive declaration vs statement) is irrelevant. It's just "all the variables".
Read more >
Svelte: Unresolved variable false-negative for reactive ...
I'm using the svelte plugin to develop a svelte app. The following piece of code is valid and works on runtime but is...
Read more >
Reactivity in Svelte - This Dot Labs
If there's any reactive variable (or statement) it will check if the component is marked as dirty and if any of its dependencies...
Read more >
Web on Reactive Stack - Spring
The reactive-stack web framework, Spring WebFlux, was added later in ... in Java 8 created opportunities for functional APIs in Java.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found