Skip to content

Commit c6a4b59

Browse files
committed
Add tests
1 parent 4538640 commit c6a4b59

6 files changed

+109
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
tests/cases/compiler/bar.ts(1,10): error TS2305: Module '"./foo"' has no exported member 'Bar'.
2+
3+
4+
==== tests/cases/compiler/foo.d.ts (0 errors) ====
5+
export = Foo;
6+
export as namespace Foo;
7+
8+
declare namespace Foo {
9+
function foo();
10+
}
11+
12+
==== tests/cases/compiler/bar.ts (1 errors) ====
13+
import { Bar, toString, foo } from './foo';
14+
~~~
15+
!!! error TS2305: Module '"./foo"' has no exported member 'Bar'.
16+
foo();
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//// [tests/cases/compiler/namedImportNonExistentName.ts] ////
2+
3+
//// [foo.d.ts]
4+
export = Foo;
5+
export as namespace Foo;
6+
7+
declare namespace Foo {
8+
function foo();
9+
}
10+
11+
//// [bar.ts]
12+
import { Bar, toString, foo } from './foo';
13+
foo();
14+
15+
//// [bar.js]
16+
"use strict";
17+
exports.__esModule = true;
18+
var foo_1 = require("./foo");
19+
foo_1.foo();
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
=== tests/cases/compiler/foo.d.ts ===
2+
export = Foo;
3+
>Foo : Symbol(Foo, Decl(foo.d.ts, 1, 24))
4+
5+
export as namespace Foo;
6+
>Foo : Symbol(Foo, Decl(foo.d.ts, 0, 13))
7+
8+
declare namespace Foo {
9+
>Foo : Symbol(Foo, Decl(foo.d.ts, 1, 24))
10+
11+
function foo();
12+
>foo : Symbol(foo, Decl(foo.d.ts, 3, 23))
13+
}
14+
15+
=== tests/cases/compiler/bar.ts ===
16+
import { Bar, toString, foo } from './foo';
17+
>Bar : Symbol(Bar, Decl(bar.ts, 0, 8))
18+
>toString : Symbol(toString, Decl(bar.ts, 0, 13))
19+
>foo : Symbol(foo, Decl(bar.ts, 0, 23))
20+
21+
foo();
22+
>foo : Symbol(foo, Decl(bar.ts, 0, 23))
23+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
=== tests/cases/compiler/foo.d.ts ===
2+
export = Foo;
3+
>Foo : typeof Foo
4+
5+
export as namespace Foo;
6+
>Foo : typeof Foo
7+
8+
declare namespace Foo {
9+
>Foo : typeof Foo
10+
11+
function foo();
12+
>foo : () => any
13+
}
14+
15+
=== tests/cases/compiler/bar.ts ===
16+
import { Bar, toString, foo } from './foo';
17+
>Bar : any
18+
>toString : () => string
19+
>foo : () => any
20+
21+
foo();
22+
>foo() : any
23+
>foo : () => any
24+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// @filename: foo.d.ts
2+
export = Foo;
3+
export as namespace Foo;
4+
5+
declare namespace Foo {
6+
function foo();
7+
}
8+
9+
declare global {
10+
namespace Bar { }
11+
}
12+
13+
// @filename: bar.d.ts
14+
import { Bar } from './foo';
15+
export = Bar;
16+
export as namespace Bar;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @filename: foo.d.ts
2+
export = Foo;
3+
export as namespace Foo;
4+
5+
declare namespace Foo {
6+
function foo();
7+
}
8+
9+
// @filename: bar.ts
10+
import { Bar, toString, foo } from './foo';
11+
foo();

0 commit comments

Comments
 (0)