Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid displayName parsing starting with v2.1.0 #395

Open
jzempel opened this issue Nov 2, 2021 · 6 comments · Fixed by #441 · May be fixed by #449
Open

Invalid displayName parsing starting with v2.1.0 #395

jzempel opened this issue Nov 2, 2021 · 6 comments · Fixed by #441 · May be fixed by #449
Labels

Comments

@jzempel
Copy link

jzempel commented Nov 2, 2021

After the removal of the parsing filter in #368, the first displayName encountered is selected, whether or not its component is exported. To test, add the following lines to the end of https://github.com/styleguidist/react-docgen-typescript/blob/master/examples/react-styleguidist-example/components/HocComponent.tsx:

Component.displayName = 'DisplayNameError';
HocComponent.displayName = 'DisplayNameSuccess';

Invalid results based on v2.1.0, tested via node -e 'console.log(require("react-docgen-typescript").parse("./ModifiedHocComponent.tsx"))'...

[
  {
    tags: {},
    filePath: './ModifiedHocComponent.tsx',
    description: '',
    displayName: 'DisplayNameError',
    methods: [],
    props: {}
  }
]

Valid results based on v2.0.0, testing the same...

[
  {
    tags: {},
    filePath: './ModifiedHocComponent.tsx',
    description: '',
    displayName: 'hoc',
    methods: [],
    props: {}
  },
  {
    tags: {},
    filePath: './ModifiedHocComponent.tsx',
    description: 'This example shows HocComponent',
    displayName: 'DisplayNameSuccess',
    methods: [],
    props: {
      prop1: [Object],
      prop2: [Object],
      prop3: [Object],
      prop4: [Object]
    }
  }
]
@pvasek
Copy link
Collaborator

pvasek commented Nov 28, 2021

I am surprised that this wasn't included in our test cases before :(
You are right that as PR #368 fixed one thing, it broke this one.

@jesstelford
Copy link

Is this the same issue as in #437? And would the suggested fix there, also fix this case?

@kylemh
Copy link
Contributor

kylemh commented Sep 17, 2022

Can you re-open this @pvasek - it was closed with #441

@pvasek pvasek reopened this Sep 17, 2022
@pvasek
Copy link
Collaborator

pvasek commented Sep 17, 2022

@kylemh thanks for pointing that out.

@kylemh kylemh linked a pull request Sep 17, 2022 that will close this issue
@github-actions
Copy link

There was no activity for a long time. The issue will be closed soon.

@github-actions github-actions bot added the stale There is no activity for a long time. label Sep 18, 2023
@kylemh
Copy link
Contributor

kylemh commented Sep 18, 2023

This issue has an open PR awaiting code review.

@github-actions github-actions bot removed the stale There is no activity for a long time. label Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants