mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 07:29:16 -05:00
Merge pull request #30776 from andrewbranch/feature/10178
Add flag to allow access to UMD globals from modules
This commit is contained in:
@@ -1648,7 +1648,7 @@ namespace ts {
|
||||
if (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
|
||||
errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation!, Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, unescapeLeadingUnderscores(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -588,6 +588,13 @@ namespace ts {
|
||||
category: Diagnostics.Module_Resolution_Options,
|
||||
description: Diagnostics.Do_not_resolve_the_real_path_of_symlinks,
|
||||
},
|
||||
{
|
||||
name: "allowUmdGlobalAccess",
|
||||
type: "boolean",
|
||||
affectsSemanticDiagnostics: true,
|
||||
category: Diagnostics.Module_Resolution_Options,
|
||||
description: Diagnostics.Allow_accessing_UMD_globals_from_modules,
|
||||
},
|
||||
|
||||
// Source Maps
|
||||
{
|
||||
|
||||
@@ -4946,5 +4946,9 @@
|
||||
"Convert parameters to destructured object": {
|
||||
"category": "Message",
|
||||
"code": 95075
|
||||
},
|
||||
"Allow accessing UMD globals from modules.": {
|
||||
"category": "Message",
|
||||
"code": 95076
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4589,6 +4589,7 @@ namespace ts {
|
||||
allowJs?: boolean;
|
||||
/*@internal*/ allowNonTsExtensions?: boolean;
|
||||
allowSyntheticDefaultImports?: boolean;
|
||||
allowUmdGlobalAccess?: boolean;
|
||||
allowUnreachableCode?: boolean;
|
||||
allowUnusedLabels?: boolean;
|
||||
alwaysStrict?: boolean; // Always combine with strict property
|
||||
|
||||
Reference in New Issue
Block a user