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

Advanced typescript annotation integration #14

Closed
mquandalle opened this issue Jun 12, 2018 · 3 comments
Closed

Advanced typescript annotation integration #14

mquandalle opened this issue Jun 12, 2018 · 3 comments
Labels
question Usage question or clarification request

Comments

@mquandalle
Copy link

Hi,

Thank you so much for Docz, I always had issues with other tools, and Docz just work. The Typescript integration with PropsTable is awesome and I'd just like to open discussion on some more advanced integration:

  • Support default value with JS default function parameters, ie function MyComponent({text = "hello"}) {}
  • Support description with JS comment above the parameter, as currently handled by the typescript language server used in IDEs, ie
    function MyComponent({
    /**
    * Documentation for the “text” parameter
    **/
    text = "hello"
    }) 
  • Support normal functions, and not exclusively React components, including with parameters typing and inline parameter documentation.

Voilà, I'm sure you already though of these items but I though it would be good to have an open discussion on it.

@pedronauck pedronauck changed the title Advanced typescript integration Advanced typescript annotation integration Jun 12, 2018
@pedronauck
Copy link
Member

pedronauck commented Jun 12, 2018

Glad you liked it @mquandalle. I'm using typescript a lot in a bunch of projects nowadays, to be honest, I'm using it for all projects and I really like it. Unfortunately, since I did not have much time, I ended up choosing to get some tool that makes this annotation integration already. In this version of docz we're using react-docgen to generate the properties table, but it is kinda limited, have a lot of trade-offs and can be a performance problem 😢One of these trade-offs is about default properties using typescript. Flow integration is so much better than typescript!

Maybe in future is good thing create something or improve react-docgen to fix these problems.

About annotations in normal functions, this is awesome and I think that is something really easy and viable to do with docz. I'm thinking about that this week and JSDocs until now is the better alternative!

@mquandalle
Copy link
Author

mquandalle commented Jun 12, 2018

I really don't know much about meta analyse of JS files, but do you think it might be viable to use the typescript language server (for both TS and JS files) to gather meta informations like types and field descriptions using the same API than IDE like VS Code?

The idea would be to use a mature high level API instead of transforming AST.

@gtkatakura
Copy link

I think it's best to open an issue at react-docgen-typescript. I've seen that this project uses react-docgen-typescript-loader, and this and this point out that this is the responsibility of react-docgen-typescript.

@pedronauck pedronauck added question Usage question or clarification request and removed enhancement labels Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usage question or clarification request
Projects
None yet
Development

No branches or pull requests

3 participants