-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
property accessor of subclass instance should return base's class property value, but uses a subclass' getter #36399
Comments
in console the result is 10 |
edit: I get what's happening and am now sad |
The emitted JS code is an incorrect downlevel. If you take the typescript code (which is valid javascript, in this case) and paste it into the same console, you get If you want fully compliant behaviour you have to set |
This is one of the subtle differences between the "old" version of TypeScript class fields and what the committee ended up shipping. |
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow. |
TypeScript Version: 3.7.2
Search Terms:
getter
property accessor
Expected behavior:
should return value from base class A, which for the example provided is 10
Actual behavior:
returns value from class B, which for the example provided is 200
Related Issues:
#36346
#29305
Code
Output
Compiler Options
Playground Link: Provided
The text was updated successfully, but these errors were encountered: