-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Unexpected behaviour #10893
Comments
I believe the compiler is working correctly here. In ES6 classes, you cannot reference The equivalent ES3/5 downlevelled code has to do things in that order too, otherwise it would not be runtime-equivalent code. |
I expect this to complie like this to ES6:
I know this does not make allot of sense on the first view, but since typescript supports In my opinion if this cannot be supported it should be removed from the language or a fix shuold be added like this. |
Duplicate #1617. |
TypeScript Version: 1.8.0
Code
Expected behavior:
Class variables should alway be accessible and set and should be compiled like this:
Entire compilation:
Actual behavior:
This causes
this.variable
in the move function of the snake class to always be undefined when constructing a new class.Entire compilation:
The text was updated successfully, but these errors were encountered: