Svelte 5: When extracting props from the $props
rune typescript eslint errors with unsafe assignment, even though the type is defined following the documentation
#804
Labels
Before You File a Bug Report Please Confirm You Have Done The Following...
What version of ESLint are you using?
9.5.0
What version of
eslint-plugin-svelte
are you using?2.40.0
What did you do?
Configuration
I created a new SvelteKit project and configured it with Svelte 5 to use runes. I used Bun as my package manager and runtime. After that I tried to create a layout file and use runes mode, but when setting up the
$props
so the layout could accept children I wasn't able to type it the same way that the Svelte's documentation uses it. I can work around it by addingas LayoutProps
after$props()
, but this feels wrong considering the documentation didn't explicitly say to typecast. I have also tested with non-route components and it also happens.What did you expect to happen?
I expected that when I typed the
$props
rune exactly as informed by the Svelte 5 preview documentation I would get no errors of unsafeany
assignments.What actually happened?
It detected getting the props for the component as an unsafe assignment.
Link to GitHub Repo with Minimal Reproducible Example
https://github.com/victoragcosta/eslint-plugin-svelte-props-unsafe-assignment-repro
Additional comments
Edit: I have tested it now and this also happens if I use
npm
andnode
instead ofbun
.The text was updated successfully, but these errors were encountered: