question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can I modify `propFilter`?

See original GitHub issue

Question

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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
rkusacommented, Dec 9, 2019

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 from node_modules. However, they were still not filtered out for me.

The issue was, that docz’ propFilter still always received a prop with parent being undefined. react-docgen-typescript will only set the prop.parent (see snippet of previous comment), if the encountered parent kind is either InterfaceDeclaration or TypeAliasDeclaration. 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 typescript 3.7, docz-core uses 3.5, this lead to a configuration where my parent interfaces (e.g. React.HTMLAttributes) had the kind 242, which was then mapped to VariableDeclarationList, which is obviously neither InterfaceDeclaration nor TypeAliasDeclaration.

I was able to fix this issue for me by forcing one typescript version via (inside my package.json):

  "resolutions": {
    "typescript": "3.7.3"
  },
3reactions
bntziocommented, Oct 22, 2018

Any updates on this?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found