Skip to content

Ports #6858 into release-1.8 #6906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/compiler/declarationEmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,6 @@ namespace ts {
}

function writeImportDeclaration(node: ImportDeclaration) {
if (!node.importClause && !(node.flags & NodeFlags.Export)) {
// do not write non-exported import declarations that don't have import clauses
return;
}
emitJsDocComments(node);
if (node.flags & NodeFlags.Export) {
write("export ");
Expand Down
1 change: 1 addition & 0 deletions tests/baselines/reference/es6ImportWithoutFromClause.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ import "es6ImportWithoutFromClause_0";
//// [es6ImportWithoutFromClause_0.d.ts]
export declare var a: number;
//// [es6ImportWithoutFromClause_1.d.ts]
import "es6ImportWithoutFromClause_0";
2 changes: 2 additions & 0 deletions tests/baselines/reference/es6ImportWithoutFromClauseAmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ export declare var a: number;
//// [es6ImportWithoutFromClauseAmd_1.d.ts]
export declare var b: number;
//// [es6ImportWithoutFromClauseAmd_2.d.ts]
import "es6ImportWithoutFromClauseAmd_0";
import "es6ImportWithoutFromClauseAmd_2";
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ require("es6ImportWithoutFromClauseInEs5_0");
//// [es6ImportWithoutFromClauseInEs5_0.d.ts]
export declare var a: number;
//// [es6ImportWithoutFromClauseInEs5_1.d.ts]
import "es6ImportWithoutFromClauseInEs5_0";
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ import "es6ImportWithoutFromClauseNonInstantiatedModule_0";
export interface i {
}
//// [es6ImportWithoutFromClauseNonInstantiatedModule_1.d.ts]
import "es6ImportWithoutFromClauseNonInstantiatedModule_0";
16 changes: 16 additions & 0 deletions tests/baselines/reference/keepImportsInDts1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//// [tests/cases/compiler/keepImportsInDts1.ts] ////

//// [test.d.ts]

export {};
//// [main.ts]
import "test"

//// [main.js]
define(["require", "exports", "test"], function (require, exports) {
"use strict";
});


//// [main.d.ts]
import "test";
6 changes: 6 additions & 0 deletions tests/baselines/reference/keepImportsInDts1.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== c:/test.d.ts ===

No type information for this code.export {};
No type information for this code.=== c:/app/main.ts ===
import "test"
No type information for this code.
6 changes: 6 additions & 0 deletions tests/baselines/reference/keepImportsInDts1.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== c:/test.d.ts ===

No type information for this code.export {};
No type information for this code.=== c:/app/main.ts ===
import "test"
No type information for this code.
22 changes: 22 additions & 0 deletions tests/baselines/reference/keepImportsInDts2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//// [tests/cases/compiler/keepImportsInDts2.ts] ////

//// [test.ts]

export {};
//// [main.ts]
import "./folder/test"

//// [test.js]
define(["require", "exports"], function (require, exports) {
"use strict";
});
//// [main.js]
define(["require", "exports", "./folder/test"], function (require, exports) {
"use strict";
});


//// [test.d.ts]
export { };
//// [main.d.ts]
import "./folder/test";
6 changes: 6 additions & 0 deletions tests/baselines/reference/keepImportsInDts2.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/folder/test.ts ===

No type information for this code.export {};
No type information for this code.=== tests/cases/compiler/main.ts ===
import "./folder/test"
No type information for this code.
6 changes: 6 additions & 0 deletions tests/baselines/reference/keepImportsInDts2.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/folder/test.ts ===

No type information for this code.export {};
No type information for this code.=== tests/cases/compiler/main.ts ===
import "./folder/test"
No type information for this code.
24 changes: 24 additions & 0 deletions tests/baselines/reference/keepImportsInDts3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//// [tests/cases/compiler/keepImportsInDts3.ts] ////

//// [test.ts]

export {};
//// [main.ts]
import "test"

//// [outputfile.js]
define("test", ["require", "exports"], function (require, exports) {
"use strict";
});
define("app/main", ["require", "exports", "test"], function (require, exports) {
"use strict";
});


//// [outputfile.d.ts]
declare module "test" {
export { };
}
declare module "app/main" {
import "test";
}
6 changes: 6 additions & 0 deletions tests/baselines/reference/keepImportsInDts3.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== c:/test.ts ===

No type information for this code.export {};
No type information for this code.=== c:/app/main.ts ===
import "test"
No type information for this code.
6 changes: 6 additions & 0 deletions tests/baselines/reference/keepImportsInDts3.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== c:/test.ts ===

No type information for this code.export {};
No type information for this code.=== c:/app/main.ts ===
import "test"
No type information for this code.
24 changes: 24 additions & 0 deletions tests/baselines/reference/keepImportsInDts4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//// [tests/cases/compiler/keepImportsInDts4.ts] ////

//// [test.ts]

export {};
//// [main.ts]
import "./folder/test"

//// [outputfile.js]
define("folder/test", ["require", "exports"], function (require, exports) {
"use strict";
});
define("main", ["require", "exports", "folder/test"], function (require, exports) {
"use strict";
});


//// [outputfile.d.ts]
declare module "folder/test" {
export { };
}
declare module "main" {
import "folder/test";
}
6 changes: 6 additions & 0 deletions tests/baselines/reference/keepImportsInDts4.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/folder/test.ts ===

No type information for this code.export {};
No type information for this code.=== tests/cases/compiler/main.ts ===
import "./folder/test"
No type information for this code.
6 changes: 6 additions & 0 deletions tests/baselines/reference/keepImportsInDts4.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/folder/test.ts ===

No type information for this code.export {};
No type information for this code.=== tests/cases/compiler/main.ts ===
import "./folder/test"
No type information for this code.
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ declare module "./observable" {
}
export {};
//// [main.d.ts]
import "./map1";
import "./map2";
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ declare module "./observable" {
}
export {};
//// [main.d.ts]
import "./map";
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ declare module "./observable" {
}
export {};
//// [main.d.ts]
import "./map";
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ declare module "observable" {
export {};
//// [main.d.ts]
/// <reference path="observable.d.ts" />
import "./map";
1 change: 1 addition & 0 deletions tests/baselines/reference/moduleAugmentationGlobal3.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ declare global {
}
export {};
//// [f3.d.ts]
import "./f2";
2 changes: 2 additions & 0 deletions tests/baselines/reference/moduleAugmentationGlobal4.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ declare global {
export { };
export {};
//// [f3.d.ts]
import "./f1";
import "./f2";
2 changes: 2 additions & 0 deletions tests/baselines/reference/moduleAugmentationGlobal5.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ require("B");
//// [f3.d.ts]
/// <reference path="f1.d.ts" />
/// <reference path="f2.d.ts" />
import "A";
import "B";
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ declare module "./f1" {
}
}
//// [f4.d.ts]
import "./f3";
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,4 @@ export declare class B {
n: number;
}
//// [f4.d.ts]
import "./f3";
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ export declare class B {
n: number;
}
//// [f4.d.ts]
import "./f3";
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ export declare class B {
n: number;
}
//// [f4.d.ts]
import "./f3";
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ declare module "./f1" {
}
}
//// [f4.d.ts]
import "./f3";
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ var y = x.getA().x;

//// [f.d.ts]
/// <reference path="array.d.ts" />
import "array";
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,6 @@ declare module "m4" {
}
}
declare module "test" {
import "m2";
import "m4";
}
1 change: 1 addition & 0 deletions tests/baselines/reference/moduleAugmentationsImports1.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,5 @@ declare module "d" {
}
}
declare module "main" {
import "d";
}
2 changes: 2 additions & 0 deletions tests/baselines/reference/moduleAugmentationsImports2.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,6 @@ declare module "e" {
}
}
declare module "main" {
import "d";
import "e";
}
2 changes: 2 additions & 0 deletions tests/baselines/reference/moduleAugmentationsImports3.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,6 @@ declare module "e" {
}
}
declare module "main" {
import "D";
import "e";
}
2 changes: 2 additions & 0 deletions tests/baselines/reference/moduleAugmentationsImports4.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,6 @@ declare module "b" {
}
}
declare module "main" {
import "D";
import "E";
}
13 changes: 0 additions & 13 deletions tests/baselines/reference/noErrorOnEmptyDts.js

This file was deleted.

8 changes: 0 additions & 8 deletions tests/baselines/reference/noErrorOnEmptyDts.symbols

This file was deleted.

8 changes: 0 additions & 8 deletions tests/baselines/reference/noErrorOnEmptyDts.types

This file was deleted.

7 changes: 7 additions & 0 deletions tests/cases/compiler/keepImportsInDts1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// @module: amd
// @declaration: true

// @filename: c:/test.d.ts
export {};
// @filename: c:/app/main.ts
import "test"
7 changes: 7 additions & 0 deletions tests/cases/compiler/keepImportsInDts2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// @module: amd
// @declaration: true

// @filename: folder/test.ts
export {};
// @filename: main.ts
import "./folder/test"
8 changes: 8 additions & 0 deletions tests/cases/compiler/keepImportsInDts3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @module: amd
// @declaration: true
// @out: outputfile.js

// @filename: c:/test.ts
export {};
// @filename: c:/app/main.ts
import "test"
8 changes: 8 additions & 0 deletions tests/cases/compiler/keepImportsInDts4.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @module: amd
// @declaration: true
// @out: outputfile.js

// @filename: folder/test.ts
export {};
// @filename: main.ts
import "./folder/test"
8 changes: 0 additions & 8 deletions tests/cases/compiler/noErrorOnEmptyDts.ts

This file was deleted.