-
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
fix: class field is not accessible via super #54056
Conversation
Just a question, does this handle the JS getter methods? Get methods work with super call in JS. |
Only class fields are affected. getter and setters work normally. |
8cd587c
to
1a3b36b
Compare
tests/baselines/reference/esDecorators-classExpression-classSuper.2.errors.txt
Outdated
Show resolved
Hide resolved
I was referred to this fix from my issue: I believe: fixes #54900 |
e66a0ec
to
2dc49db
Compare
@typescript-bot run dt |
Heya @andrewbranch, I've started to run the diff-based top-repos suite on this PR at 2dc49db. You can monitor the build here. Update: The results are in! |
Heya @andrewbranch, I've started to run the parallelized Definitely Typed test suite on this PR at 2dc49db. You can monitor the build here. Update: The results are in! |
@andrewbranch Here are the results of running the top-repos suite comparing Something interesting changed - please have a look. Details
|
Hey @andrewbranch, the results of running the DT tests are ready. |
These errors might be interesting to look at. |
In appsmith, the code presumably works at runtime because the compile target is |
Sorry, I'm confused, in what case it can be valid? I cannot think of a setup that defines a class field on the prototype instead of the instance. |
Hm, I assumed that a quirk of the transformation down to ES2015 would make it work somehow, but I think you’re right. Maybe this stuff isn’t working at all? This is very odd 🤔 |
Even stranger, the first error, in appsmith, looks like a typo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that this should go into 5.3 to avoid breaking vscode after the 5.2 beta.
In the meantime, I had one small nit about the test, but I'm not 100% what a better solution is.
2dc49db
to
4b820cb
Compare
Co-authored-by: Nathan Shively-Sanders <[email protected]>
- Bumps `typescript` and `ts-expose-internals` to v5.3.3 - Removes the test diagnostic for `noSuperProperty` as the compiler catches this now (microsoft/TypeScript/pull/54056) - Make 1:1 changes for methods and fields - Handles the `NoSubstitutionTemplateLiteral` node from microsoft/TypeScript/pull/55930 Please take a look at the module resolution change. I'm not sure if this will have downstream effects that I couldn't catch in testing. Closes #2610 --------- Co-authored-by: Osyris <[email protected]>
TypeScript/JavaScript uses prototype-based inheritance where fields are stored in a flat structure and not in the scope of a particular class definition in the hierarchy. This means that a field specified by a parent class can be replaced by one specified by one of the children. To signal this behaviour, starting in v5.3.0, the TypeScript compiler prevents a class from assigning values to fields specified by a parent class using "super" (microsoft/TypeScript#54056). This patch, upgrades the TypeScript compiler to the latest version and fixes the remaining issues related to the topic mentioned above that now result in compiler errors. Additionally, it also updates the launch task that runs the compiler to ensure it uses a local version of the compiler, as specified by the dependency graph of the VSCode Extension package. Change-Id: Ib3ef774028ec4587c6b8e5eaa2eb395188e0d5a1
fixes #54054
fixes #35314
fixes #54900