Skip to content

Commit 5fb6474

Browse files
committed
Add test
1 parent 6f07a90 commit 5fb6474

File tree

5 files changed

+157
-0
lines changed

5 files changed

+157
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
foo.ts(2,8): suggestion TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.
2+
foo.ts(3,8): suggestion TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.
3+
foo.ts(3,12): suggestion TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.
4+
5+
6+
==== foo.ts (3 errors) ====
7+
// Error
8+
module notok { }
9+
~~~~~
10+
!!! suggestion TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.
11+
module not.ok { }
12+
~~~
13+
!!! suggestion TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.
14+
~~
15+
!!! suggestion TS1540: A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.
16+
17+
// OK
18+
declare module fine { }
19+
declare module also.fine { }
20+
21+
// Still the only way to do it
22+
declare module "good" { }
23+
24+
==== decl.d.ts (0 errors) ====
25+
// OK since these are ambient
26+
declare module foo { }
27+
declare module foo.bar { }
28+
29+
// Still the only way to do it
30+
declare module "alsogood" { }
31+
32+
export module exported { }
33+
export module exported.sub { }
34+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//// [tests/cases/compiler/moduleKeywordDeprecated.ts] ////
2+
3+
//// [foo.ts]
4+
// Error
5+
module notok { }
6+
module not.ok { }
7+
8+
// OK
9+
declare module fine { }
10+
declare module also.fine { }
11+
12+
// Still the only way to do it
13+
declare module "good" { }
14+
15+
//// [decl.d.ts]
16+
// OK since these are ambient
17+
declare module foo { }
18+
declare module foo.bar { }
19+
20+
// Still the only way to do it
21+
declare module "alsogood" { }
22+
23+
export module exported { }
24+
export module exported.sub { }
25+
26+
27+
//// [foo.js]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//// [tests/cases/compiler/moduleKeywordDeprecated.ts] ////
2+
3+
=== foo.ts ===
4+
// Error
5+
module notok { }
6+
>notok : Symbol(notok, Decl(foo.ts, 0, 0))
7+
8+
module not.ok { }
9+
>not : Symbol(not, Decl(foo.ts, 1, 16))
10+
>ok : Symbol(ok, Decl(foo.ts, 2, 11))
11+
12+
// OK
13+
declare module fine { }
14+
>fine : Symbol(fine, Decl(foo.ts, 2, 17))
15+
16+
declare module also.fine { }
17+
>also : Symbol(also, Decl(foo.ts, 5, 23))
18+
>fine : Symbol(fine, Decl(foo.ts, 6, 20))
19+
20+
// Still the only way to do it
21+
declare module "good" { }
22+
>"good" : Symbol("good", Decl(foo.ts, 6, 28))
23+
24+
=== decl.d.ts ===
25+
// OK since these are ambient
26+
declare module foo { }
27+
>foo : Symbol(foo, Decl(decl.d.ts, 0, 0), Decl(decl.d.ts, 1, 22))
28+
29+
declare module foo.bar { }
30+
>foo : Symbol(foo, Decl(decl.d.ts, 0, 0), Decl(decl.d.ts, 1, 22))
31+
>bar : Symbol(bar, Decl(decl.d.ts, 2, 19))
32+
33+
// Still the only way to do it
34+
declare module "alsogood" { }
35+
>"alsogood" : Symbol("alsogood", Decl(decl.d.ts, 2, 26))
36+
37+
export module exported { }
38+
>exported : Symbol(exported, Decl(decl.d.ts, 5, 29), Decl(decl.d.ts, 7, 26))
39+
40+
export module exported.sub { }
41+
>exported : Symbol(exported, Decl(decl.d.ts, 5, 29), Decl(decl.d.ts, 7, 26))
42+
>sub : Symbol(sub, Decl(decl.d.ts, 8, 23))
43+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//// [tests/cases/compiler/moduleKeywordDeprecated.ts] ////
2+
3+
=== foo.ts ===
4+
// Error
5+
module notok { }
6+
module not.ok { }
7+
8+
// OK
9+
declare module fine { }
10+
declare module also.fine { }
11+
12+
// Still the only way to do it
13+
declare module "good" { }
14+
>"good" : typeof import("good")
15+
> : ^^^^^^^^^^^^^^^^^^^^^
16+
17+
=== decl.d.ts ===
18+
// OK since these are ambient
19+
declare module foo { }
20+
declare module foo.bar { }
21+
22+
// Still the only way to do it
23+
declare module "alsogood" { }
24+
>"alsogood" : any
25+
> : ^^^
26+
27+
export module exported { }
28+
export module exported.sub { }
29+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// @filename: foo.ts
2+
3+
// Error
4+
module notok { }
5+
module not.ok { }
6+
7+
// OK
8+
declare module fine { }
9+
declare module also.fine { }
10+
11+
// Still the only way to do it
12+
declare module "good" { }
13+
14+
// @filename: decl.d.ts
15+
16+
// OK since these are ambient
17+
declare module foo { }
18+
declare module foo.bar { }
19+
20+
// Still the only way to do it
21+
declare module "alsogood" { }
22+
23+
export module exported { }
24+
export module exported.sub { }

0 commit comments

Comments
 (0)