From dac00d97b742c81b1e31ac1880b3d71e4a2a0b37 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 15 Aug 2018 09:00:23 -0700 Subject: [PATCH] Do it correctly. --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 46c7481692..7b059833be 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15473,7 +15473,7 @@ namespace ts { // With noImplicitThis, functions may not reference 'this' if it has type 'any' error( node, - capturedByArrowFunction ? + capturedByArrowFunction && container.kind === SyntaxKind.SourceFile ? Diagnostics.The_containing_arrow_function_captures_the_global_value_of_this_which_implicitly_has_type_any : Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); }