Can I modify `propFilter`?
See original GitHub issueQuestion
Hi, is there a way I can modify docgen-typescript’s propsFilter
?
Description I have the same exact issue as https://github.com/styleguidist/react-docgen-typescript/pull/111 were my PropsTable is populated with all the html props/attrs which makes it a bit hard to use. I was wondering if there is a way I can pass the same function as he is using:
propFilter: (prop) => {
if (prop.parent == null) {
return true;
}
return prop.parent.fileName.indexOf('node_modules/@types/react') < 0;
}
Seems like thats all I should need
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (1 by maintainers)
Top Results From Across the Web
TypeScript - Storybook
Storybook has built-in TypeScript support, so your TypeScript project should work with zero configuration needed. Default configuration.
Read more >schrodinger.application.bioluminate.propfilter module ...
For the SELECT operator, value can be a list of values. ... Modified from the parent class to select all the objects in...
Read more >Property Filter (Propfilter) - NodePit
Select structures based on Maestro properties. Filter conditions must be specified in the form “name op value”, or just name. Here, name is...
Read more >Storybook: auto generate docs from typescript - Stack Overflow
Modified 1 year, 5 months ago. Viewed 2k times. This question shows research effort; it is useful and clear. 3. This question does...
Read more >Drift Ghost (4K, X, XL) Adpater w/ Prop Filter - Flight Flix Aviation
Drift Ghost (4K, X, XL) Adpater w/ Prop Filter. $29.99 ... Quickly change any FF37 Filter. ... More videos. Your browser can't play...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For everyone coming to this issue, I think I finally found out what is going on here. For the use case of this issue, we don’t really need the custom
propFilter
, since docz already ignores properties coming fromnode_module
s. However, they were still not filtered out for me.The issue was, that docz’
propFilter
still always received aprop
withparent
beingundefined
.react-docgen-typescript
will only set theprop.parent
(see snippet of previous comment), if the encountered parent kind is eitherInterfaceDeclaration
orTypeAliasDeclaration
. As you can see here, those are mapped by numbers. Now, those numbers seem to change between typescript versions and while my app was using typescript3.7
,docz-core
uses3.5
, this lead to a configuration where my parent interfaces (e.g.React.HTMLAttributes
) had the kind242
, which was then mapped toVariableDeclarationList
, which is obviously neitherInterfaceDeclaration
norTypeAliasDeclaration
.I was able to fix this issue for me by forcing one
typescript
version via (inside mypackage.json
):Any updates on this?