-
-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent false positive store declarations (#2422)
variable declarations not at the top level can't be subscribed to using the `$` prefix
- Loading branch information
1 parent
6e64abd
commit 5312279
Showing
3 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/svelte2tsx/test/svelte2tsx/samples/$store-nested-declaration/expectedv2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
///<reference types="svelte" /> | ||
;function render() { | ||
|
||
function x(tr) { | ||
for (let notAStore of tr.effects) {} | ||
} | ||
|
||
$notAStore; | ||
; | ||
async () => {}; | ||
return { props: /** @type {Record<string, never>} */ ({}), slots: {}, events: {} }} | ||
|
||
export default class Input__SvelteComponent_ extends __sveltets_2_createSvelte2TsxComponent(__sveltets_2_partial(__sveltets_2_with_any_event(render()))) { | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/svelte2tsx/test/svelte2tsx/samples/$store-nested-declaration/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script> | ||
function x(tr) { | ||
for (let notAStore of tr.effects) {} | ||
} | ||
$notAStore; | ||
</script> |