Skip to content

Commit ce51343

Browse files
committed
Adding testcase for the incorrect eliding of the import declarations
1 parent a54f974 commit ce51343

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//// [tests/cases/compiler/elidingImportNames.ts] ////
2+
3+
//// [elidingImportNames_test.ts]
4+
5+
import a = require('elidingImportNames_main'); // alias used in typeof
6+
var b = a;
7+
var x: typeof a;
8+
import a2 = require('elidingImportNames_main1'); // alias not used in typeof
9+
var b2 = a2;
10+
11+
12+
//// [elidingImportNames_main.ts]
13+
export var main = 10;
14+
15+
//// [elidingImportNames_main1.ts]
16+
export var main = 10;
17+
18+
//// [elidingImportNames_main.js]
19+
exports.main = 10;
20+
//// [elidingImportNames_main1.js]
21+
exports.main = 10;
22+
//// [elidingImportNames_test.js]
23+
var b = a;
24+
var x;
25+
var a2 = require('elidingImportNames_main1'); // alias not used in typeof
26+
var b2 = a2;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
=== tests/cases/compiler/elidingImportNames_test.ts ===
2+
3+
import a = require('elidingImportNames_main'); // alias used in typeof
4+
>a : typeof a
5+
6+
var b = a;
7+
>b : typeof a
8+
>a : typeof a
9+
10+
var x: typeof a;
11+
>x : typeof a
12+
>a : typeof a
13+
14+
import a2 = require('elidingImportNames_main1'); // alias not used in typeof
15+
>a2 : typeof a2
16+
17+
var b2 = a2;
18+
>b2 : typeof a2
19+
>a2 : typeof a2
20+
21+
22+
=== tests/cases/compiler/elidingImportNames_main.ts ===
23+
export var main = 10;
24+
>main : number
25+
26+
=== tests/cases/compiler/elidingImportNames_main1.ts ===
27+
export var main = 10;
28+
>main : number
29+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// @module: commonjs
2+
3+
// @Filename: elidingImportNames_test.ts
4+
import a = require('elidingImportNames_main'); // alias used in typeof
5+
var b = a;
6+
var x: typeof a;
7+
import a2 = require('elidingImportNames_main1'); // alias not used in typeof
8+
var b2 = a2;
9+
10+
11+
// @Filename: elidingImportNames_main.ts
12+
export var main = 10;
13+
14+
// @Filename: elidingImportNames_main1.ts
15+
export var main = 10;

0 commit comments

Comments
 (0)