Skip to content

Unable to process props of a component when using synthetic default export in the target component file #102

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

Closed
amacleay opened this issue Jun 18, 2018 · 1 comment

Comments

@amacleay
Copy link

Setup:

  • Create a project using allowSyntheticDefaultImports
  • Create a component file in that project which imports React using a synthetic default import: import React from 'react'; and add a component which extends React.Component
  • Run react-docgen-typescript on this file

Expected behavior:
Props are successfully processed

Actual behavior:
No props are reported as existing on the component

FWIW, I don't actually know if this is an issue with this project. It seems to be a complex interaction of the typescript parser and this project which results in this behavior. I have been stepping through extractPropsFromTypeIfStatefulComponent and, in the failing case, instanceType.getProperty('props') returns null, but instanceType.getProperty('prop1') (or whatever an individual prop is called) returns the expected type for that individual property.

I'm happy to help in any way to figure this out, but I'm a bit stumped at the moment. Thanks!

I added a PR just to demonstrate this issue: #101

@amacleay
Copy link
Author

As noted in #100, we solved this by changing "target" in tsconfig.json to ES6 (see linked issue for details)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant