Skip to content

Typing rest props with JSDoc #14836

Answered by OrakMoya
OrakMoya asked this question in Q&A
Discussion options

You must be logged in to vote

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>

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by OrakMoya
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant