-
-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
What version of ESLint are you using?
9.34.0
What version of eslint-plugin-svelte
are you using?
3.11.0
What did you do?
Configuration
import js from "@eslint/js";
import sveltePlugin from "eslint-plugin-svelte";
import tseslint from "typescript-eslint";
export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
...sveltePlugin.configs["flat/recommended"],
{
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
languageOptions: {
parserOptions: {
parser: tseslint.parser,
extraFileExtensions: [".svelte"],
projectService: true
},
}
},
{
rules: {
'@typescript-eslint/no-unsafe-assignment': 'error',
}
}
);
ComponentA.svelte
<script lang="ts">
let {a}: {a: number} = $props();
</script>
<p>{a}</p>
MyComponent.svelte ← error occurs here
<script lang="ts">
import type { ComponentProps } from 'svelte';
import ComponentA from './ComponentA.svelte'
interface Props {
a: ComponentProps<typeof ComponentA>['a']
}
let { a }: Props = $props()
</script>
<ComponentA {a} />
What did you expect to happen?
a
should be inferred correctly as number
based on the typings of ComponentA
What actually happened?
The other component's prop instead is inferred as any: Unsafe object destructuring of a property with an
any value.
Link to GitHub Repo with Minimal Reproducible Example
Additional comments
No response
Metadata
Metadata
Assignees
Labels
No labels