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

Support ES6 Static Getters #61

Closed
kcjonson opened this issue Mar 2, 2016 · 1 comment
Closed

Support ES6 Static Getters #61

kcjonson opened this issue Mar 2, 2016 · 1 comment
Milestone

Comments

@kcjonson
Copy link

kcjonson commented Mar 2, 2016

Forgive me if I'm wrong on this one, but react-docgen does not appear to support static getters in ES6 classes at the moment. Would be awesome if it did. If Im reading the docs right, this is simply a new resolver and the existing handlers can be reused?

static get displayName() {
    return "button";
}

static get defaultProps() {
    return {
        type: "primary",
    };
}
@kcjonson kcjonson changed the title Support Static Getters Support ES6 Static Getters Mar 2, 2016
@fkling
Copy link
Member

fkling commented Mar 2, 2016

If Im reading the docs right, this is simply a new resolver and the existing handlers can be reused?

Not quite. Resolvers just find component definitions. They don't extract any information. Handlers are functions which get passed the found component definitions and extract the information.

But also here, we tried to make everything transparent so that handlers don't have to care what kind of component definitions they get (class, stateless, etc).

However, looking at the code, this should already work for, for defaultProps at least. displayName needs to be updated to look into functions.

@fkling fkling added this to the v3 milestone Sep 27, 2016
@fkling fkling closed this as completed in 8cef62d Sep 29, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants