-
I have a couple of components that can be assigned classes. I want to access these classes via I typed $props like so: <script>
/** @typedef {Object} Props
* @property {Number} number
* @property {(num: Number)=>void} onChange
* @property {any} rest
*/
/** @type {Props} */
let { number = $bindable(0), onChange = (_) => {}, ...rest } = $props();
</script> However, I'm getting a JSDoc error: After the automatic migration to Svelte 5, I can see the script converted some components to TypeScript and typed the rest props like so: <script lang="ts">
interface Props {
[key: string]: any;
}
let { ...rest }: Props = $props();
</script> I'm not sure how to do the same with JSDoc. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Nevermind, I saw in another migrated file the script picked JSDoc and typed it like so: <script>
/** @typedef Props
* @prop {Number} number
* @prop {(num: Number)=>void} onChange
*/
/** @type {Props & { [key: string]: any }} */
let { number = $bindable(0), onChange = (_) => {}, ...rest } = $props();
</script> |
Beta Was this translation helpful? Give feedback.
Nevermind, I saw in another migrated file the script picked JSDoc and typed it like so: