Skip to content

fix: forward static functions in babel #187

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

Merged
merged 1 commit into from
Nov 28, 2017
Merged

fix: forward static functions in babel #187

merged 1 commit into from
Nov 28, 2017

Conversation

ktsn
Copy link
Member

@ktsn ktsn commented Nov 7, 2017

Static methods are defined as non-enumerable properties in Babel, so Babel users cannot use static methods.

I've changed the implementation with getOwnPropertyNames and use the original property descriptor on defining the property on the extended constructor.

This also changes the extended constructor's name and length property. But it probably does not affect user's code.

fix #186

@HerringtonDarkholme
Copy link
Member

IIRC some environment, say PhantomJS, disallow reassigning name or length. This might be a pitfall.

@ktsn
Copy link
Member Author

ktsn commented Nov 9, 2017

It looks disallow reassigning but configurable, so we can use defineProperty for it.
I'm not sure whether all browsers do not have unconfigurable properties, though.

@ktsn ktsn merged commit 2bc36c5 into master Nov 28, 2017
@ktsn ktsn deleted the babel-static-members branch November 28, 2017 14:43
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

Successfully merging this pull request may close these issues.

Class Component static method is undefined
2 participants