Skip to content

Commit 71ad30e

Browse files
author
王文璐
committed
remove useless parameter
1 parent 13820fa commit 71ad30e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/services/codefixes/fixAddMissingUndefinedType.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace ts.codefix {
2222
return;
2323
}
2424

25-
addUndefinedType(changes, diag.file, propertyDeclaration, propertyDeclaration.type);
25+
addUndefinedType(changes, diag.file, propertyDeclaration);
2626
});
2727
},
2828
});
@@ -43,15 +43,14 @@ namespace ts.codefix {
4343
}
4444

4545
function getActionsForAddMissingUndefinedType (context: CodeFixContext, token: Identifier, propertyDeclaration: PropertyDeclaration): CodeFixAction[] | undefined {
46-
const typeNode = propertyDeclaration.type;
4746
const description = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Declare_property_0), [token.text]);
48-
const changes = textChanges.ChangeTracker.with(context, t => addUndefinedType(t, context.sourceFile, propertyDeclaration, typeNode));
47+
const changes = textChanges.ChangeTracker.with(context, t => addUndefinedType(t, context.sourceFile, propertyDeclaration));
4948
const action = { description, changes, fixId };
5049
return [ action ];
5150
}
5251

53-
function addUndefinedType(changeTracker: textChanges.ChangeTracker, propertyDeclarationSourceFile: SourceFile, propertyDeclaration: PropertyDeclaration, typeNode: TypeNode): void {
54-
const newTypeNode = createUnionTypeNode([typeNode, createKeywordTypeNode(SyntaxKind.UndefinedKeyword)]);
52+
function addUndefinedType(changeTracker: textChanges.ChangeTracker, propertyDeclarationSourceFile: SourceFile, propertyDeclaration: PropertyDeclaration): void {
53+
const newTypeNode = createUnionTypeNode([propertyDeclaration.type, createKeywordTypeNode(SyntaxKind.UndefinedKeyword)]);
5554
changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration.type, newTypeNode);
5655
}
5756
}

0 commit comments

Comments
 (0)