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

Add example : how to extract Props / State interface from react component using compiler API #65

Open
stepancar opened this issue Apr 14, 2016 · 2 comments

Comments

@stepancar
Copy link
Contributor

Hello.
I have this sources

import * as React from 'react';

export interface MyComponentProps{
    prop1: number;
    prop2: string;
}
/**
* descriptions for component
*/
export  class MyComponent extends React.Component<MyComponentProps,{}>{
   render(){
     return(
       <div>
       </div>
     );
   }
}

I use docgen from this wiki example

this is output

[
    {
        "name": "MyComponent",
        "documentation": "descriptions for component",
        "type": "typeof MyComponent",
        "constructors": [
            {
                "paramters": [],
                "returnType": "MyComponent",
                "documentation": ""
            }
        ]
    }
]

I want to extend this output by type of first generic passed to react.component.

How to extract generic type passed to parent class?
Thank you!

@stepancar
Copy link
Contributor Author

@sebastian-lenz, could you help me, please?
As I understand, you already solved the same issue in your typeDoc

@stepancar
Copy link
Contributor Author

I mean same .net reflection functionality

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