Import Props Types from a Svelte 5 Component in JSDoc

Heads-up: the following code is for Svelte 5. See Export JSDoc Types from Svelte 4 Components for a similar note if you use Svelte 4. Sometimes in JSDoc, we need to get the type of a Svelte component’s props in a different module. Svelte provides ComponentProps to achieve that goal: // other-module.js /** * @import { ComponentProps } from 'svelte' * @import ListComponent from 'path/to/List.svelte'…