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

Props not detected unless "import * as React from 'react'" #323

Closed
crobinson42 opened this issue Feb 10, 2021 · 7 comments
Closed

Props not detected unless "import * as React from 'react'" #323

crobinson42 opened this issue Feb 10, 2021 · 7 comments
Labels
stale There is no activity for a long time.

Comments

@crobinson42
Copy link

The TS interface/type used for a component's props are not picked up unless in the same file all of React is imported via: import * as React from 'react'.

This is a bug that needs addressing - happy to help, point me in the direction.

I stumbled across this here also:

strothj/react-docgen-typescript-loader#10 (comment)

@olee
Copy link

olee commented Jul 27, 2021

Did anyone manage to resolve this issue yet?

@coder966
Copy link

In my case changing the export type of the components from default export to named export fixed it.

@olee

@olee
Copy link

olee commented Aug 8, 2021

Well that's not what I call a solution but a workaround 😅

@MilesWellsSVT
Copy link

MilesWellsSVT commented Oct 29, 2021

When React is imported via import React from 'react' this line has an additional member called intrinsicName which comes back as 'error'. The returned ts.Type is also missing the members .symbol and .aliasSymbol. ts.Type.getSymbol also returns undefined.

This lack of a symbol causes getComponentInfo to return an empty object for props because both ts.Type.getCallSignatures and ts.Type.getConstructSignatures return an empty array.

I've never delved into this part of JS/TS so my lack of knowledge is hampering my progress. I would appreciate it if someone could take this info and either run with it or provide me with a poke in the right direction. @hipstersmoothie and @pvasek have touched this area most recently (though it has been a while). Could either of you help me out?

@Hideman85
Copy link

I'm looking forward to this issue too, I just recently introduce storybook in our project and I don't get the docgen working

@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 Jan 13, 2023
@github-actions
Copy link

Closing this issue as obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale There is no activity for a long time.
Projects
None yet
Development

No branches or pull requests

5 participants