parent
686fd1e62d
commit
4cf289e1a5
3 changed files with 9 additions and 11 deletions
|
@ -112,11 +112,11 @@ namespace ts.codefix {
|
|||
createIdentifier("undefined")));
|
||||
|
||||
const propertyInitializationChangeTracker = textChanges.ChangeTracker.fromContext(context);
|
||||
propertyInitializationChangeTracker.insertNodeAt(
|
||||
propertyInitializationChangeTracker.insertNodeBefore(
|
||||
classDeclarationSourceFile,
|
||||
classConstructor.body.getEnd() - 1,
|
||||
classConstructor.body.getLastToken(),
|
||||
propertyInitialization,
|
||||
{ prefix: context.newLineCharacter, suffix: context.newLineCharacter });
|
||||
{ suffix: context.newLineCharacter });
|
||||
|
||||
const initializeAction = {
|
||||
description: formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Initialize_property_0_in_the_constructor), [tokenName]),
|
||||
|
|
|
@ -15,12 +15,11 @@
|
|||
verify.codeFix({
|
||||
description: "Initialize property 'foo' in the constructor.",
|
||||
index: 0,
|
||||
// TODO: GH#18741 and GH#18445
|
||||
// TODO: GH#18445
|
||||
newFileContent: `class C {
|
||||
constructor() {
|
||||
\r
|
||||
this.foo = undefined;\r
|
||||
}
|
||||
this.foo = undefined;\r
|
||||
}
|
||||
method() {
|
||||
this.foo === 10;
|
||||
}
|
||||
|
|
|
@ -13,12 +13,11 @@
|
|||
verify.codeFix({
|
||||
description: "Initialize property 'foo' in the constructor.",
|
||||
index: 0,
|
||||
// TODO: GH#18741 and GH#18445
|
||||
// TODO: GH#18445
|
||||
newFileContent: `class C {
|
||||
constructor() {
|
||||
\r
|
||||
this.foo = undefined;\r
|
||||
}
|
||||
this.foo = undefined;\r
|
||||
}
|
||||
prop = ()=>{ this.foo === 10 };
|
||||
}`
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue