Uh oh!
There was an error while loading. Please reload this page.
Error on class fields accesses through super in JS files - #55892
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| !!! error TS2855: Class field 'justProp' defined by the parent class is not accessible in the child class via super. | ||
| } | ||
| get literalElementAccessTests() { | ||
| return super.literalElementAccess; |
There was a problem hiding this comment.
Can you add a test for super["literalElementAccess"] as well?
Also, can you just add a test for super.b? I bet we have no test for super. on an accessor declaration at all.
There was a problem hiding this comment.
Can you add a test for super["literalElementAccess"] as well?
Good catch. It doesn't work correctly today (TS playground) even in TS files. For that reason - I'd say that this is a separate issue. I can look into it as well but I'd prefer to explore it separately.
Also, can you just add a test for super.b? I bet we have no test for super. on an accessor declaration at all.
Sure thing, just added it.
Can you add a test for this case in JavaScript as well and confirm it works? // @checkJs: true// @filename: foo.jsexportclassC{staticblah1=123;}C.blah2=456;exportclassDextendsC{static{console.log(super.blah1);console.log(super.blah2);}}along with this: // @checkJs: true// @filename: foo.jsclassC{constructor(){this.foo=()=>{console.log("called arrow")}}foo(){console.log("called method")}}classDextendsC{foo(){console.log("SUPER:");super.foo();console.log("THIS:");this.foo();}}constobj=newD();obj.foo();D.prototype.foo.call(obj); |
Mateusz Burzyński (Andarist)
commented
Sep 28, 2023
Added both - I had to fix one of them 😉 |
Jake Bailey (jakebailey)
commented
Sep 29, 2023
TypeScript Bot (@typescript-bot) test top100 |
Heya Jake Bailey (@jakebailey), I've started to run the diff-based top-repos suite on this PR at 23ec307. You can monitor the build here. Update: The results are in! |
Heya Jake Bailey (@jakebailey), I've started to run the diff-based user code test suite on this PR at 23ec307. You can monitor the build here. Update: The results are in! |
TypeScript Bot (typescript-bot)
commented
Sep 29, 2023
Jake Bailey (@jakebailey) Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
| /** @internal */ | ||
| export function isClassFieldAndNotAutoAccessor(node: Node): boolean { | ||
| export function isClassFieldAndNotAutoAccessor(node: Declaration): boolean { |
There was a problem hiding this comment.
| exportfunctionisClassFieldAndNotAutoAccessor(node: Declaration): boolean{ | |
| exportfunctionisClassInstanceProperty(node: Declaration): boolean{ |
TypeScript Bot (typescript-bot)
commented
Sep 29, 2023
Jake Bailey (@jakebailey) Here are the results of running the top-repos suite comparing Everything looks good! |
Let's get this in for 5.3 beta and do the rename after. |
fixes#55884
follow up to #54056