-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
Take the following code:
export abstract class YaddaBase {
protected roots = "hi";
}
export class DerivedYadda extends YaddaBase {
public get rootTests() {
return super.roots;
}
}
TypeScript nightly (5.3.0-dev.20230926) reports:
Class field 'roots' defined by the parent class is not accessible in the child class via super.
The error message here is confusing - one might believe that this has to do with accessing a member with a protected modifier, but it is really about accessing an instance field with super
. A better error message would be:
'roots' is defined as an instance property and must be accessed through 'this', not 'super'.
We can also provide a quick fix for this error message.
fatcerberus, Tucaen, davidda, larrybahr-ocelot, tt-nghia and 1 more
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone