-
-
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
Follow up to #2659
When referencing properties of destructured variables in a type, it will show the error Cannot find name '<variable>'
in both svelte-check and the language server.
Workaround is to do (typeof <variable>)["<property>"]
instead of typeof <variable>.<property>
.
Reproduction
<script lang="ts">
import type { PageData } from './$types.js';
type Props = {
data: PageData;
};
let { data }: Props = $props();
type Fails = typeof data.cfg; // error here: Cannot find name 'data'
type Okay = (typeof data)['cfg'];
</script>
Expected behaviour
Shouldn't throw a type error.
System Info
- OS: MacOS
- IDE: VSCode
Which package is the issue about?
svelte-language-server, svelte-check
Additional Information, eg. Screenshots
No response
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