-
-
Notifications
You must be signed in to change notification settings - Fork 212
Closed
Labels
FixedFixed in master branch. Pending production release.Fixed in master branch. Pending production release.bugSomething isn't workingSomething isn't working
Description
Describe the bug
In certain situations, running VSCode's organize imports action will result in broken code.
E.g. Running organize imports on the following file produces broken code
<script lang="ts">
import { page } from '$app/stores'
let { foo }: { foo: string } = $props()
console.log(foo, $page.url)
</script>
results in
<script lang="ts">
import { page } from '$app/stores'
{ foo: string } = $props()
console.log(foo, $page.url)
</script>
This does not happen if $props
is typed using a type/interface:
<script lang="ts">
import { page } from '$app/stores'
interface Props {
foo: string
}
let { foo }: Props = $props()
console.log(foo, $page.url)
</script>
Nor does it happen if there are no imports.
Reproduction
<script lang="ts">
import { page } from '$app/stores'
let { foo }: { foo: string } = $props()
console.log(foo, $page.url)
</script>
Expected behaviour
Unused imports are removed and the code is unmodified otherwise.
System Info
- OS: MacOS
- IDE: VSCode
- Svelte for VSCode extension: v109.3.2
Which package is the issue about?
Svelte for VS Code extension
Additional Information, eg. Screenshots
No response
enyo and rodrigocfd
Metadata
Metadata
Assignees
Labels
FixedFixed in master branch. Pending production release.Fixed in master branch. Pending production release.bugSomething isn't workingSomething isn't working