Skip to content

Commit ce8641f

Browse files
committed
Merge branch 'master' into iocaptureFixes
2 parents d9112f5 + 89718cf commit ce8641f

9 files changed

+43
-6
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ namespace ts {
965965
// Escape the name in the "require(...)" clause to ensure we find the right symbol.
966966
let moduleName = escapeIdentifier(moduleReferenceLiteral.text);
967967

968-
if (!moduleName) {
968+
if (moduleName === undefined) {
969969
return;
970970
}
971971
let isRelative = isExternalModuleNameRelative(moduleName);

src/compiler/diagnosticInformationMap.generated.ts

+1
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ namespace ts {
431431
Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: DiagnosticCategory.Error, key: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." },
432432
Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." },
433433
Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." },
434+
Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." },
434435
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
435436
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
436437
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },

src/compiler/diagnosticMessages.json

+4
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,10 @@
17131713
"category": "Error",
17141714
"code": 2655
17151715
},
1716+
"Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition.": {
1717+
"category": "Error",
1718+
"code": 2656
1719+
},
17161720
"Import declaration '{0}' is using private name '{1}'.": {
17171721
"category": "Error",
17181722
"code": 4000

src/compiler/program.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ namespace ts {
863863
if (importedFile && resolution.isExternalLibraryImport) {
864864
if (!isExternalModule(importedFile)) {
865865
let start = getTokenPosOfNode(file.imports[i], file)
866-
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.File_0_is_not_a_module, importedFile.fileName));
866+
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName));
867867
}
868868
else if (!fileExtensionIs(importedFile.fileName, ".d.ts")) {
869869
let start = getTokenPosOfNode(file.imports[i], file)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
tests/cases/compiler/emptyModuleName.ts(1,20): error TS2307: Cannot find module ''.
2+
3+
4+
==== tests/cases/compiler/emptyModuleName.ts (1 errors) ====
5+
import * as A from "";
6+
~~
7+
!!! error TS2307: Cannot find module ''.
8+
class B extends A {
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//// [emptyModuleName.ts]
2+
import * as A from "";
3+
class B extends A {
4+
}
5+
6+
//// [emptyModuleName.js]
7+
var __extends = (this && this.__extends) || function (d, b) {
8+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
9+
function __() { this.constructor = d; }
10+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
11+
};
12+
var A = require("");
13+
var B = (function (_super) {
14+
__extends(B, _super);
15+
function B() {
16+
_super.apply(this, arguments);
17+
}
18+
return B;
19+
})(A);

tests/baselines/reference/nodeResolution5.errors.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
tests/cases/compiler/b.ts(1,20): error TS2306: File 'tests/cases/compiler/node_modules/a.d.ts' is not a module.
1+
tests/cases/compiler/b.ts(1,20): error TS2656: Exported external package typings file 'tests/cases/compiler/node_modules/a.d.ts' is not a module. Please contact the package author to update the package definition.
22

33

44
==== tests/cases/compiler/b.ts (1 errors) ====
55
import y = require("a");
66
~~~
7-
!!! error TS2306: File 'a.d.ts' is not a module.
7+
!!! error TS2656: Exported external package typings file 'a.d.ts' is not a module. Please contact the package author to update the package definition.
88

99
==== tests/cases/compiler/node_modules/a.d.ts (0 errors) ====
1010

tests/baselines/reference/nodeResolution7.errors.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
tests/cases/compiler/b.ts(1,20): error TS2306: File 'tests/cases/compiler/node_modules/a/index.d.ts' is not a module.
1+
tests/cases/compiler/b.ts(1,20): error TS2656: Exported external package typings file 'tests/cases/compiler/node_modules/a/index.d.ts' is not a module. Please contact the package author to update the package definition.
22

33

44
==== tests/cases/compiler/b.ts (1 errors) ====
55
import y = require("a");
66
~~~
7-
!!! error TS2306: File 'index.d.ts' is not a module.
7+
!!! error TS2656: Exported external package typings file 'index.d.ts' is not a module. Please contact the package author to update the package definition.
88

99
==== tests/cases/compiler/node_modules/a/index.d.ts (0 errors) ====
1010

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// @module: commonjs
2+
import * as A from "";
3+
class B extends A {
4+
}

0 commit comments

Comments
 (0)