storybookjs / addon-svelte-csf

[Incubation] CSF using Svelte components.
MIT License
103 stars 32 forks source link

[Bug] JSDoc prop descriptions aren't added to autodocs #122

Closed Masstronaut closed 1 year ago

Masstronaut commented 1 year ago

Describe the bug

Svelte component props documented with the officially recommended method - JSDoc comments - don't have their description added to the autodocs. Example:

<script lang="ts">
    // Alert.svelte
    /** 
     * The variant sets the styling of the alert.
     * Use `Alert` variants to provide additional context to the user about the alert information. */
    export let variant: AlertVariant | undefined = undefined;
</script>

Elsewhere in VSCode - including in *.stories.svelte files - this comment shows up as a tooltip for the variant prop of the Alert component. You can see in this screenshot that hovering over variant on an Alert component causes the tooltip and description to appear:

image

However, in my autodocs for the Alert component, the description for the variant prop is not present:

image

Steps to reproduce the behavior

  1. Create a svelte component with a prop that has a JSDoc comment describing it
  2. enable autodocs globally for the project since it can't be specified on a per-component level with svelte-csf (See #87 )
  3. create a svelte CSF story for the component
  4. run storybook and look at the generated autodocs for it. Note that the prop documentation is not present.

Expected behavior

Prop comments should be included in the appropriate place in autodocs

Screenshots and/or logs

See screenshots above

Environment

Additional context

Add any other context about the problem here.

JReinhold commented 1 year ago

This is unrelated to this addon, but actually a problem in Storybook's doc parsing not supporting TypeScript. Check out https://github.com/storybookjs/storybook/issues/15891 which describes why and a potential workaround.

Closing in favor of https://github.com/storybookjs/storybook/issues/15891