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

Property types don't show up #1551

Closed
smashercosmo opened this issue Mar 11, 2020 · 6 comments
Closed

Property types don't show up #1551

smashercosmo opened this issue Mar 11, 2020 · 6 comments

Comments

@smashercosmo
Copy link
Collaborator

After upgrading to latest styleguidist (the one with native TS support) property types stopped showing up

Screenshot 2020-03-11 at 14 06 17

Current behavior

With react-docgen-typescript you could see property types

To reproduce

Try to use react-styleguidist with TS

Expected behavior

You should be able to see property types

@mitsuruog
Copy link
Contributor

I have the same issue. version isv11.0.1.

react-styleguidist issues 1551 - CodeSandbox

Here is my sandbox.

@sapegin
Copy link
Member

sapegin commented Mar 13, 2020

Feel free to send a pull request with a fix 👾

@mitsuruog
Copy link
Contributor

In my case, there are 2 issues.

  1. react-docgen does not parse the type of the component correctly.

The type of this component will not parse anything.

export const Button: React.FC<ButtonProps> = props => {
  // ...
}

But this component can parse.

export function Button(props: ButtonProps) {
  // ...
}

It might be an issue or limitation for react-docgen.

  1. react-styleguidist does not render tsType even if react-docgen has parsed successfully.

react-docgen returns tsType including the type info, but the current version does not seem to handle this correctly.

@mitsuruog
Copy link
Contributor

@sapegin I am working on it. 😉

@mitsuruog
Copy link
Contributor

@sapegin I want to hear your opinion.

I am wondering how to display types in the UI for TypeScript.
It is a little different in the result of the UI from the way what the old version was.
because for the TypeScript users, it used to use react-docgen-typescript, but now it uses react-docgen.

ex)

If type is something like:

prop3: () => void;

Old version:

Prop name: prop3
Type: () => void;

New version:

Prop name: prop3
Type: function
// NOTE: `() => void` goes to tooltip

stylesheet-example-column

Since I've been looking at the old version for a long time, the new version of the result feels a bit difficult to use. but it has an inconsistency for the result of flowType.

so should I keep the way for react-docgen-typescript or take consistency for the flowType.

@styleguidist-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 11.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

4 participants