You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.
It'd be nice if the type info (source file, parent) that react-docgen-typescript produces were preserved in some form.
We're currently producing components with interfaces like this:
typeCtaLinkProps=React.ComponentPropsWithoutRef<'a'>&{/** Contains a URL that the hyperlink points to. */href: string;children: ReactRequiredChildren;};
The upshot of this being that in addition to the explicitly defined propTypes, we also get all the HTML props. We like this behavior however....it'd be nice to break the props table that Info displays into "defined by Component" props and "defined by underlying element" prop. We could do this with a custom PropTable, but without the source type info we can't break down the prop types without some really bizzare hacks. Are only other option is to filter out the HTMLElement props using propFilter, but we'd like to keep them in some form.
I'd be willing to make a PR to this end if there is interest.
The text was updated successfully, but these errors were encountered:
You'll need to review the docgen structure returned from the underlying react-docgen-typescript project to determine if the information you need is present or not. That library performs the actual data extraction from the source code.
If it doesn't provide the necessary information, you'd need to make a pull request there first to expose it. After you've exposed that information, it should be straight forward to attach it in this Webpack loader. This loader takes that information and attaches it to each component as a field.
From there you'd either use a custom table component or follow this up with a pull request to the relevant Storybook add-on.
I'd be happy to accept any pull request you make if you decide to develop this feature.
It'd be nice if the type info (source file, parent) that react-docgen-typescript produces were preserved in some form.
We're currently producing components with interfaces like this:
The upshot of this being that in addition to the explicitly defined propTypes, we also get all the HTML props. We like this behavior however....it'd be nice to break the props table that Info displays into "defined by Component" props and "defined by underlying element" prop. We could do this with a custom
PropTable
, but without the source type info we can't break down the prop types without some really bizzare hacks. Are only other option is to filter out the HTMLElement props usingpropFilter
, but we'd like to keep them in some form.I'd be willing to make a PR to this end if there is interest.
The text was updated successfully, but these errors were encountered: