Skip to content

How to Typing snippets with JSDoc in javascript ? #15071

Answered by brunnerh
Fd929c2CE5fA asked this question in Q&A
Discussion options

You must be logged in to vote

Typing the props, e.g:

<script>
  /** @import { Snippet } from 'svelte' */;

  /**
   * @type {{
   *   snippet: Snippet<[number]>
   * }}
   */
  const { snippet } = $props();
</script>

Typing snippet args in the template:

{#snippet test(/** @type {number} */ arg)}
  ...
{/snippet}

Replies: 1 comment

Comment options

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