strothj / react-docgen-typescript-loader

Webpack loader to generate docgen information from Typescript React components.
Other
360 stars 47 forks source link

JSDoc block is displaying inline #39

Open stramel opened 5 years ago

stramel commented 5 years ago

My code looks like:

/**
 * Hook to check the action permission based on the rules and user's roles
 *
 * @param action - Action to check permission for
 * @param data - Any data necessary for dynamic checks
 * @param options - Allows overriding the rules and/or roles
 * @return - True, if the user has permission to perform the provided action
 */
export function useAccess(action: ValidRule, data?: object, options: AccessOverrides = {}) {
  //...
}

It generates a "description" of:

Hook to check the action permission based on the rules and user’s roles @param action - Action to check permission for @param data - Any data necessary for dynamic checks @param options - Allows overriding the rules and/or roles @return - True, if the user has permission to perform the provided action

I would expect it to pull the description out and parse the params/returns into the props table.

strothj commented 5 years ago

Where are you accessing the documentation for hooks in Storybook? It didn't occur to me there was a way to do that.

stramel commented 5 years ago

@strothj Using the @storybook/addon-info plugin for documentation. (https://github.com/storybooks/storybook/tree/master/addons/info)

Hooks are relatively unsupported AFAICT. Mostly just creating wrapping components in the story currently. The docs were still visible though.

strothj commented 5 years ago

Can you post the source of the story file? I want to get a better idea of what’s going on.

stramel commented 5 years ago

@strothj here is the story and hook https://gist.github.com/stramel/96aac465ed0fffba9cd2056ec8cd7580

UPDATE: Updated with my storybook config too.

This is based on a Typescript CRA project