-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svelte 5: Cannot get $props types from component with children #10644
Comments
Please provide a proper reproduction (you can also use the REPL) |
Unsure how a REPL can help here, as it does not show the TS errors, but I added the REPL to the description above. |
Thanks, I copied over the REPL into VS Code and I don't get said TypeScript errors. Make sure to update to the latest version of VS Code and Svelte. There were changes to snippets recently which needed adjustment in the VS Code extension. Please let me know if this fixes the issue. |
I still have the same error. All versions should be the latest:
I don't know, if this helps, but running |
It sounds like VS Code isn't finding your installed Svelte version and then resorts to using its own. If you search for the |
It logs |
Is this snippet import type { ComponentProps } from 'svelte';
import Component from './Component.svelte';
type Props = ComponentProps<Component>; Inside a TypeScript (not a Svelte) file by any chance? If so, then this is a duplicate of sveltejs/language-tools#2297 |
Oh no - I did not think that there is was difference between svelte and ts files. |
Closing in favor of sveltejs/language-tools#2297 then 👍 |
Describe the bug
For components without children I can simply use
but for components with children I get this error:
Type 'default' does not satisfy the constraint 'SvelteComponent<any, any, any>'. Type 'default' is missing the following properties from type 'SvelteComponent<any, any, any>': $$prop_def, $$events_def, $$slot_def, $destroy, and 2 more.
Any tips how to fix that?
Reproduction
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE51SYWujQBD9K8MSMAGJ0PaTMbZ6f-Cg_XZ7FIljsqCzy86kJYj__Vi16bVNW-6-iDPP9-a9cXrVmBZZpb96RVWHKlWFcypWcnKh4CdsBVWs2B79LnQy3nnjBNqK9luthLXKNQGYzlkvEHjQww_bOUtI8tNbxzBA420H0SQXbTRpmQnFDK2TYn0BLs9w-TdMWpIE-GCfGdw4Igzm0B8dFI_T4O07J1mRb96Q5-IhkKIam-rYSgS1RQayAlyJ4eYEckDYWWLxlSGB6H60ctbOKjrF8PLIo3XYyEdZw9AZZkP7UbCxbWufQxUioBeDPMUdM3w3JIXFIhAfa2xiWCzwCUn4peLWyvxeI4u3I62GK-isx7Xw8ur65mZ13lj52cbKaWOasmT69XnYf1YkuaaszMssKXMVq87WpjFYq1T8EYf49Z7-_Zq0aGlRoIcKBtjCGJOzvkpZvKH9kC9Xm3eGiq88lP_j4e1F35NxDuXiKc9eY9gdTFt7pIuuX-HbdFa7FKS_80g1-vPXy9UQ-h_z_R7-ADUAlVG_AwAA
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: