Skip to content

Commit 050fb36

Browse files
authored
Fix broken augmentExportEquals2 test fixture (#64748)
Signed-off-by: MaheshDesu <mahesh.desu3@gmail.com>
1 parent f25ef1c commit 050fb36

5 files changed

Lines changed: 82 additions & 7 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
file2.ts(4,16): error TS2671: Cannot augment module './file1' because it resolves to a non-module entity.
2+
file3.ts(3,8): error TS2503: Cannot find namespace 'x'.
3+
4+
5+
==== file3.ts (1 errors) ====
6+
import x = require("./file1");
7+
import "./file2";
8+
let a: x.A; // should not work
9+
~
10+
!!! error TS2503: Cannot find namespace 'x'.
11+
==== file1.ts (0 errors) ====
12+
function foo() {}
13+
export = foo;
14+
15+
==== file2.ts (1 errors) ====
16+
import x = require("./file1");
17+
18+
// should error since './file1' does not have namespace meaning
19+
declare module "./file1" {
20+
~~~~~~~~~
21+
!!! error TS2671: Cannot augment module './file1' because it resolves to a non-module entity.
22+
interface A { a }
23+
}
24+

‎tsc/testdata/baselines/reference/compiler/augmentExportEquals2.js‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,20 @@ declare module "./file1" {
1212
interface A { a }
1313
}
1414

15-
//// [file3.ts]
16-
1715
//// [file3.ts]
1816
import x = require("./file1");
1917
import "./file2";
2018
let a: x.A; // should not work
2119

20+
//// [file1.js]
21+
"use strict";
22+
function foo() { }
23+
module.exports = foo;
24+
//// [file2.js]
25+
"use strict";
26+
Object.defineProperty(exports, "__esModule", { value: true });
2227
//// [file3.js]
2328
"use strict";
29+
Object.defineProperty(exports, "__esModule", { value: true });
30+
require("./file2");
31+
let a; // should not work
Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
11
//// [tests/cases/compiler/augmentExportEquals2.ts] ////
22

33
=== file3.ts ===
4-
54
import x = require("./file1");
5+
>x : Symbol(x, Decl(file3.ts, 0, 0))
6+
67
import "./file2";
78
let a: x.A; // should not work
8-
=== file3.ts ===
9+
>a : Symbol(a, Decl(file3.ts, 2, 3))
10+
>x : Symbol(x)
11+
>A : Symbol(x.A)
12+
13+
=== file1.ts ===
14+
function foo() {}
15+
>foo : Symbol(foo, Decl(file1.ts, 0, 0))
16+
17+
export = foo;
18+
>foo : Symbol(foo, Decl(file1.ts, 0, 0))
19+
20+
=== file2.ts ===
21+
import x = require("./file1");
22+
>x : Symbol(x, Decl(file2.ts, 0, 0))
23+
24+
// should error since './file1' does not have namespace meaning
25+
declare module "./file1" {
26+
>"./file1" : Symbol("./file1", Decl(file2.ts, 0, 30))
27+
28+
interface A { a }
29+
>A : Symbol(A, Decl(file2.ts, 3, 26))
30+
>a : Symbol(A.a, Decl(file2.ts, 4, 17))
31+
}
932

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
11
//// [tests/cases/compiler/augmentExportEquals2.ts] ////
22

33
=== file3.ts ===
4-
54
import x = require("./file1");
5+
>x : () => void
6+
67
import "./file2";
78
let a: x.A; // should not work
8-
=== file3.ts ===
9+
>a : x.A
10+
>x : any
11+
12+
=== file1.ts ===
13+
function foo() {}
14+
>foo : () => void
15+
16+
export = foo;
17+
>foo : () => void
18+
19+
=== file2.ts ===
20+
import x = require("./file1");
21+
>x : () => void
22+
23+
// should error since './file1' does not have namespace meaning
24+
declare module "./file1" {
25+
>"./file1" : any
26+
27+
interface A { a }
28+
>a : any
29+
}
930

‎tsc/testdata/tests/cases/compiler/augmentExportEquals2.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ declare module "./file1" {
1414
interface A { a }
1515
}
1616

17-
// @filename: file3.ts
1817
// @filename: file3.ts
1918
import x = require("./file1");
2019
import "./file2";

0 commit comments

Comments
 (0)