2020-04-10 00:06:45 +02:00
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
|
|
|
// @strict: true
|
|
|
|
|
|
|
|
//// class A {
|
|
|
|
//// get x() { return 1 }
|
|
|
|
//// }
|
|
|
|
//// class B extends A {
|
|
|
|
//// x = 2
|
|
|
|
//// }
|
|
|
|
//// class C {
|
|
|
|
//// get x() { return 3 }
|
|
|
|
//// }
|
|
|
|
//// class D extends C {
|
|
|
|
//// x = 4
|
|
|
|
//// }
|
|
|
|
|
|
|
|
verify.codeFixAll({
|
|
|
|
fixId: "fixPropertyOverrideAccessor",
|
2020-04-10 01:43:31 +02:00
|
|
|
fixAllDescription: "Generate 'get' and 'set' accessors for all overriding properties",
|
2020-04-10 00:06:45 +02:00
|
|
|
newFileContent: `class A {
|
|
|
|
get x() { return 1 }
|
|
|
|
}
|
|
|
|
class B extends A {
|
|
|
|
private _x = 2
|
|
|
|
public get x() {
|
|
|
|
return this._x
|
|
|
|
}
|
|
|
|
public set x(value) {
|
|
|
|
this._x = value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
class C {
|
|
|
|
get x() { return 3 }
|
|
|
|
}
|
|
|
|
class D extends C {
|
|
|
|
private _x = 4
|
|
|
|
public get x() {
|
|
|
|
return this._x
|
|
|
|
}
|
|
|
|
public set x(value) {
|
|
|
|
this._x = value
|
|
|
|
}
|
|
|
|
}`,
|
|
|
|
})
|