-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Method class enumerable #15038
Comments
None of them @jwbay, properties should be enumerable according with ES6 Classes. Using Object.keys() or for-in loop shows the properties. However, this is not the case for methods. |
When dealing with ES5 class constructs, methods are just prototype 'properties' that happen to be functions. |
Exactly but not in ES6, and the transpile from ES6 to ES5 should be equal right? I mean, if I change my target from ES5 to ES6 and in a part of my code I was using Object.keys() or for-in loop for getting name methods; the code will not work. |
As mentioned in #22354, also applies to static methods. Still occurs in 2.7.0. |
The impact of this is pretty small in practice and ES5 runtimes are getting pretty rare. We don't intend to address this given the other churn it would necessitate. |
TypeScript Version: 2.2.2
Code
Expected behavior:
ES5 or ES6 target, the methods should be non-enumerable.
Actual behavior:
In ES5 the methods are enumerable.
The text was updated successfully, but these errors were encountered: