Properly check if a codefix is needed

This commit is contained in:
Florian Regensburger
2018-11-02 01:47:50 +01:00
parent 70fee3fb36
commit 94118b64c5

View File

@@ -6,7 +6,7 @@ namespace ts.codefix {
errorCodes,
getCodeActions: (context) => {
const changes = textChanges.ChangeTracker.with(context, t => makeChange(t, context.sourceFile, context.span.start));
if (changes) {
if (changes.length > 0) {
return [createCodeFixAction(fixId, changes, Diagnostics.Add_const_to_unresolved_variable, fixId, Diagnostics.Add_const_to_all_unresolved_variables)];
}
},