react-docgen-typescript-loader icon indicating copy to clipboard operation
react-docgen-typescript-loader copied to clipboard

JSDoc block is displaying inline

Open stramel opened this issue 6 years ago • 4 comments
trafficstars

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.

stramel avatar Mar 27 '19 21:03 stramel

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

strothj avatar Mar 28 '19 07:03 strothj

@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.

stramel avatar Apr 05 '19 20:04 stramel

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

strothj avatar Apr 05 '19 20:04 strothj

@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

stramel avatar Apr 05 '19 22:04 stramel