Skip to content

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

3 participants