parent
4ce2280559
commit
d37391fcfc
|
@ -909,8 +909,8 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
// If we're in an external module, we can't reference symbols created from UMD export declarations
|
||||
if (result && isInExternalModule) {
|
||||
// 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) {
|
||||
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);
|
||||
|
|
25
tests/baselines/reference/umd8.errors.txt
Normal file
25
tests/baselines/reference/umd8.errors.txt
Normal file
|
@ -0,0 +1,25 @@
|
|||
tests/cases/conformance/externalModules/a.ts(7,14): error TS2686: Identifier 'Foo' must be imported from a module
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/a.ts (1 errors) ====
|
||||
/// <reference path="foo.d.ts" />
|
||||
import * as ff from './foo';
|
||||
|
||||
let y: Foo; // OK in type position
|
||||
y.foo();
|
||||
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
|
||||
|
||||
==== tests/cases/conformance/externalModules/foo.d.ts (0 errors) ====
|
||||
|
||||
declare class Thing {
|
||||
foo(): number;
|
||||
}
|
||||
declare namespace Thing {
|
||||
interface SubThing { }
|
||||
}
|
||||
export = Thing;
|
||||
export as namespace Foo;
|
||||
|
|
@ -5,17 +5,25 @@
|
|||
declare class Thing {
|
||||
foo(): number;
|
||||
}
|
||||
declare namespace Thing {
|
||||
interface SubThing { }
|
||||
}
|
||||
export = Thing;
|
||||
export as namespace Foo;
|
||||
|
||||
//// [a.ts]
|
||||
/// <reference path="foo.d.ts" />
|
||||
let y: Foo;
|
||||
y.foo();
|
||||
import * as ff from './foo';
|
||||
|
||||
let y: Foo; // OK in type position
|
||||
y.foo();
|
||||
let z: Foo.SubThing; // OK in ns position
|
||||
let x: any = Foo; // Not OK in value position
|
||||
|
||||
|
||||
//// [a.js]
|
||||
/// <reference path="foo.d.ts" />
|
||||
var y;
|
||||
"use strict";
|
||||
var y; // OK in type position
|
||||
y.foo();
|
||||
var z; // OK in ns position
|
||||
var x = Foo; // Not OK in value position
|
||||
|
|
|
@ -5,11 +5,17 @@
|
|||
declare class Thing {
|
||||
foo(): number;
|
||||
}
|
||||
declare namespace Thing {
|
||||
interface SubThing { }
|
||||
}
|
||||
export = Thing;
|
||||
export as namespace Foo;
|
||||
|
||||
// @filename: a.ts
|
||||
/// <reference path="foo.d.ts" />
|
||||
let y: Foo;
|
||||
y.foo();
|
||||
import * as ff from './foo';
|
||||
|
||||
let y: Foo; // OK in type position
|
||||
y.foo();
|
||||
let z: Foo.SubThing; // OK in ns position
|
||||
let x: any = Foo; // Not OK in value position
|
||||
|
|
Loading…
Reference in a new issue