Microsoft/TypeScript
Voir sur GitHubIndexing/element access on `super` avoids instance property checks
Open
#55 899 ouverte le 28 sept. 2023
BugDomain: classesEffort: CasualFix AvailableHelp WantedRescheduled
Métriques du dépôt
- Stars
- (48 455 stars)
- Métriques de merge PR
- (Merge moyen 6j 17h) (9 PRs mergées en 30 j)
Description
Discovered in conversation at https://github.com/microsoft/TypeScript/pull/55892#discussion_r1339658106
class C {
yadda = () => {};
}
class D extends C {
badda() {
super["yadda"]();
}
}
new D().badda()
Currently there is no error for this code; however, if you switched it to a property access, you'd get the error introduced at https://github.com/microsoft/TypeScript/pull/54056.
class C {
yadda = () => {};
}
class D extends C {
badda() {
super.yadda(); // ❌ errors, as expected
}
}