mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Merge pull request #11570 from Microsoft/fixErrorMessageForUmdGlobals
Fix error message for UMD globals
This commit is contained in:
@@ -922,7 +922,7 @@ namespace ts {
|
||||
if (result && isInExternalModule && (meaning & SymbolFlags.Value) === SymbolFlags.Value) {
|
||||
const decls = result.declarations;
|
||||
if (decls && decls.length === 1 && decls[0].kind === SyntaxKind.NamespaceExportDeclaration) {
|
||||
error(errorLocation, Diagnostics.Identifier_0_must_be_imported_from_a_module, name);
|
||||
error(errorLocation, Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1923,7 +1923,7 @@
|
||||
"category": "Error",
|
||||
"code": 2685
|
||||
},
|
||||
"Identifier '{0}' must be imported from a module": {
|
||||
"'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead.": {
|
||||
"category": "Error",
|
||||
"code": 2686
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/externalModules/a.ts(6,9): error TS2686: Identifier 'Foo' must be imported from a module
|
||||
tests/cases/conformance/externalModules/a.ts(6,9): error TS2686: 'Foo' refers to a UMD global, but the current file is a module. Consider adding an import instead.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/a.ts (1 errors) ====
|
||||
@@ -9,7 +9,7 @@ tests/cases/conformance/externalModules/a.ts(6,9): error TS2686: Identifier 'Foo
|
||||
// should error
|
||||
let z = Foo;
|
||||
~~~
|
||||
!!! error TS2686: Identifier 'Foo' must be imported from a module
|
||||
!!! error TS2686: 'Foo' refers to a UMD global, but the current file is a module. Consider adding an import instead.
|
||||
|
||||
==== tests/cases/conformance/externalModules/foo.d.ts (0 errors) ====
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/externalModules/a.ts(7,14): error TS2686: Identifier 'Foo' must be imported from a module
|
||||
tests/cases/conformance/externalModules/a.ts(7,14): error TS2686: 'Foo' refers to a UMD global, but the current file is a module. Consider adding an import instead.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/a.ts (1 errors) ====
|
||||
@@ -10,7 +10,7 @@ tests/cases/conformance/externalModules/a.ts(7,14): error TS2686: Identifier 'Fo
|
||||
let z: Foo.SubThing; // OK in ns position
|
||||
let x: any = Foo; // Not OK in value position
|
||||
~~~
|
||||
!!! error TS2686: Identifier 'Foo' must be imported from a module
|
||||
!!! error TS2686: 'Foo' refers to a UMD global, but the current file is a module. Consider adding an import instead.
|
||||
|
||||
==== tests/cases/conformance/externalModules/foo.d.ts (0 errors) ====
|
||||
|
||||
|
||||
Reference in New Issue
Block a user