Skip to content

Autosubscriptions not working in <script> #98

Closed
@cortopy

Description

@cortopy

Describe the bug
As mentioned in #81, autosubscriptions work in the html part but not <script>

In the following:

<script lang="ts">
	import { count } from './stores.js';
	import Incrementer from './Incrementer.svelte';
	import Decrementer from './Decrementer.svelte';
	import Resetter from './Resetter.svelte';

        let isLarge = $count > 10;
</script>

<h1>Count is now {isLarge ? "large" : "small"}</h1>

<Incrementer/>
<Decrementer/>
<Resetter/>

two errors are thrown because (1) count is not used and (2) $count is undefined.

I know this example is pretty dumb because the evaluation could be done in the HTML, but basically using autosubscriptions in the <script> confuses the ts transpiler.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions