-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Quick FixesEditor-provided fixes, often called code actions.Editor-provided fixes, often called code actions.FixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 3.0.0-dev.201xxxxx
Search Terms:
Code
class C {
method() {
this.a = 0;
}
}
class D {
method() {
this.a = 0;
}
} Expected behavior:
class C {
a: number;
method() {
this.a = 0;
}
}
class D {
a: number;
method() {
this.a = 0;
}
} Actual behavior:
class C {
a: number;
method() {
this.a = 0;
}
}
class D {
method() {
this.a = 0;
}
} Playground Link:
Related Issues:
Discovered in https://github.com/Microsoft/TypeScript/pull/25182/files#r198680755
Caused by the use of the property name as a key for seen dictionary in the fixall code path.
One interesting problem here is the handling of inherited properties. we probably want to skip declaring a property in a derived class, first for brevity, and second to avoid conflicting type declarations when possible. if so, then the key will need to be a bit more involved than just a string.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Quick FixesEditor-provided fixes, often called code actions.Editor-provided fixes, often called code actions.FixedA PR has been merged for this issueA PR has been merged for this issue