From 94118b64c5bf082e7bdaa06a71046fbe921d61b5 Mon Sep 17 00:00:00 2001 From: Florian Regensburger Date: Fri, 2 Nov 2018 01:47:50 +0100 Subject: [PATCH] Properly check if a codefix is needed --- src/services/codefixes/addMissingConstInForLoop.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/codefixes/addMissingConstInForLoop.ts b/src/services/codefixes/addMissingConstInForLoop.ts index d1534c7020f..3caea2222fa 100644 --- a/src/services/codefixes/addMissingConstInForLoop.ts +++ b/src/services/codefixes/addMissingConstInForLoop.ts @@ -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)]; } },