report error if module name is empty

This commit is contained in:
Vladimir Matveev committed 2015-09-14 14:33:35 -07:00
1 parent 90273f995d
commit 5636655cf4
4 files changed
+33 -1

No files matched your search

+1 -1
View File
@@ -965,7 +965,7 @@ namespace ts {
// Escape the name in the "require(...)" clause to ensure we find the right symbol.
let moduleName = escapeIdentifier(moduleReferenceLiteral.text);
if (!moduleName) {
if (moduleName === undefined) {
return;
}
let isRelative = isExternalModuleNameRelative(moduleName);
@@ -0,0 +1,9 @@
tests/cases/compiler/emptyModuleName.ts(1,20): error TS2307: Cannot find module ''.
==== tests/cases/compiler/emptyModuleName.ts (1 errors) ====
import * as A from "";
~~
!!! error TS2307: Cannot find module ''.
class B extends A {
}
@@ -0,0 +1,19 @@
//// [emptyModuleName.ts]
import * as A from "";
class B extends A {
}
//// [emptyModuleName.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var A = require("");
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
}
return B;
})(A);
+4
View File
@@ -0,0 +1,4 @@
// @module: commonjs
import * as A from "";
class B extends A {
}