From 11e45162ea9b3a8fcf852418b658f5da3ecb2302 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 5 Apr 2019 11:09:16 -0700 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20emit=20diagnostic=20accessing?= =?UTF-8?q?=20UMD=20globals=20from=20modules=20when=20flag=20is=20set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/checker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 18078339d84..53360297995 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1632,10 +1632,10 @@ namespace ts { } // If we're in an external module, we can't reference value symbols created from UMD export declarations - if (result && isInExternalModule && (meaning & SymbolFlags.Value) === SymbolFlags.Value && !(originalLocation!.flags & NodeFlags.JSDoc)) { + if (!compilerOptions.allowUmdGlobalAccess && result && isInExternalModule && (meaning & SymbolFlags.Value) === SymbolFlags.Value && !(originalLocation!.flags & NodeFlags.JSDoc)) { const merged = getMergedSymbol(result); if (length(merged.declarations) && every(merged.declarations, d => isNamespaceExportDeclaration(d) || isSourceFile(d) && !!d.symbol.globalExports)) { - error(errorLocation!, Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, unescapeLeadingUnderscores(name)); // TODO: GH#18217 + error(errorLocation!, Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, unescapeLeadingUnderscores(name)); } } }