Skip to content

Commit 9fa9710

Browse files
author
Andy Hanson
committed
Add tests for more kinds of import/export
1 parent 75c1d77 commit 9fa9710

8 files changed

Lines changed: 106 additions & 6 deletions

tests/baselines/reference/ambientShorthand.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ declare module "fs";
99
///<reference path="declarations.d.ts"/>
1010
import foo, {bar} from "jquery";
1111
import * as baz from "fs";
12-
foo(bar, baz);
12+
import boom = require("jquery");
13+
foo(bar, baz, boom);
1314

1415

1516
//// [user.js]
1617
"use strict";
1718
///<reference path="declarations.d.ts"/>
1819
var jquery_1 = require("jquery");
1920
var baz = require("fs");
20-
jquery_1["default"](jquery_1.bar, baz);
21+
var boom = require("jquery");
22+
jquery_1["default"](jquery_1.bar, baz, boom);

tests/baselines/reference/ambientShorthand.symbols

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ import foo, {bar} from "jquery";
77
import * as baz from "fs";
88
>baz : Symbol(baz, Decl(user.ts, 2, 6))
99

10-
foo(bar, baz);
10+
import boom = require("jquery");
11+
>boom : Symbol(boom, Decl(user.ts, 2, 26))
12+
13+
foo(bar, baz, boom);
1114
>foo : Symbol(foo, Decl(user.ts, 1, 6))
1215
>bar : Symbol(bar, Decl(user.ts, 1, 13))
1316
>baz : Symbol(baz, Decl(user.ts, 2, 6))
17+
>boom : Symbol(boom, Decl(user.ts, 2, 26))
1418

1519
=== tests/cases/conformance/ambient/declarations.d.ts ===
1620
declare module "jquery"

tests/baselines/reference/ambientShorthand.types

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ import foo, {bar} from "jquery";
77
import * as baz from "fs";
88
>baz : any
99

10-
foo(bar, baz);
11-
>foo(bar, baz) : any
10+
import boom = require("jquery");
11+
>boom : any
12+
13+
foo(bar, baz, boom);
14+
>foo(bar, baz, boom) : any
1215
>foo : any
1316
>bar : any
1417
>baz : any
18+
>boom : any
1519

1620
=== tests/cases/conformance/ambient/declarations.d.ts ===
1721
declare module "jquery"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//// [tests/cases/conformance/ambient/ambientShorthand_reExport.ts] ////
2+
3+
//// [declarations.d.ts]
4+
declare module "jquery";
5+
6+
//// [reExportX.ts]
7+
export {x} from "jquery";
8+
9+
//// [reExportAll.ts]
10+
export * from "jquery";
11+
12+
//// [reExportUser.ts]
13+
import {x} from "./reExportX";
14+
import * as $ from "./reExportAll";
15+
// '$' is not callable, it is an object.
16+
x($);
17+
18+
19+
//// [reExportX.js]
20+
"use strict";
21+
var jquery_1 = require("jquery");
22+
exports.x = jquery_1.x;
23+
//// [reExportAll.js]
24+
"use strict";
25+
//// [reExportUser.js]
26+
"use strict";
27+
var reExportX_1 = require("./reExportX");
28+
var $ = require("./reExportAll");
29+
// '$' is not callable, it is an object.
30+
reExportX_1.x($);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
=== tests/cases/conformance/ambient/declarations.d.ts ===
2+
declare module "jquery";
3+
No type information for this code.
4+
No type information for this code.=== tests/cases/conformance/ambient/reExportX.ts ===
5+
export {x} from "jquery";
6+
>x : Symbol(x, Decl(reExportX.ts, 0, 8))
7+
8+
=== tests/cases/conformance/ambient/reExportAll.ts ===
9+
export * from "jquery";
10+
No type information for this code.
11+
No type information for this code.=== tests/cases/conformance/ambient/reExportUser.ts ===
12+
import {x} from "./reExportX";
13+
>x : Symbol(x, Decl(reExportUser.ts, 0, 8))
14+
15+
import * as $ from "./reExportAll";
16+
>$ : Symbol($, Decl(reExportUser.ts, 1, 6))
17+
18+
// '$' is not callable, it is an object.
19+
x($);
20+
>x : Symbol(x, Decl(reExportUser.ts, 0, 8))
21+
>$ : Symbol($, Decl(reExportUser.ts, 1, 6))
22+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
=== tests/cases/conformance/ambient/declarations.d.ts ===
2+
declare module "jquery";
3+
No type information for this code.
4+
No type information for this code.=== tests/cases/conformance/ambient/reExportX.ts ===
5+
export {x} from "jquery";
6+
>x : any
7+
8+
=== tests/cases/conformance/ambient/reExportAll.ts ===
9+
export * from "jquery";
10+
No type information for this code.
11+
No type information for this code.=== tests/cases/conformance/ambient/reExportUser.ts ===
12+
import {x} from "./reExportX";
13+
>x : any
14+
15+
import * as $ from "./reExportAll";
16+
>$ : typeof $
17+
18+
// '$' is not callable, it is an object.
19+
x($);
20+
>x($) : any
21+
>x : any
22+
>$ : typeof $
23+

tests/cases/conformance/ambient/ambientShorthand.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ declare module "fs";
77
///<reference path="declarations.d.ts"/>
88
import foo, {bar} from "jquery";
99
import * as baz from "fs";
10-
foo(bar, baz);
10+
import boom = require("jquery");
11+
foo(bar, baz, boom);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// @Filename: declarations.d.ts
2+
declare module "jquery";
3+
4+
// @Filename: reExportX.ts
5+
export {x} from "jquery";
6+
7+
// @Filename: reExportAll.ts
8+
export * from "jquery";
9+
10+
// @Filename: reExportUser.ts
11+
import {x} from "./reExportX";
12+
import * as $ from "./reExportAll";
13+
// '$' is not callable, it is an object.
14+
x($);

0 commit comments

Comments
 (0)