error if import empty object form module not existed

This commit is contained in:
kingwl 2017-12-14 09:26:05 +08:00 committed by 王文璐
parent b31aa4e012
commit eba4d36739
6 changed files with 28 additions and 1 deletions

View File

@ -23852,7 +23852,10 @@ namespace ts {
checkImportBinding(importClause.namedBindings);
}
else {
forEach(importClause.namedBindings.elements, checkImportBinding);
const moduleExisted = resolveExternalModuleName(node, node.moduleSpecifier);
if (moduleExisted) {
forEach(importClause.namedBindings.elements, checkImportBinding);
}
}
}
}

View File

@ -0,0 +1,8 @@
tests/cases/conformance/es6/modules/importEmptyFromModuleNotExisted.ts(1,16): error TS2307: Cannot find module 'module-not-existed'.
==== tests/cases/conformance/es6/modules/importEmptyFromModuleNotExisted.ts (1 errors) ====
import {} from 'module-not-existed'
~~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'module-not-existed'.

View File

@ -0,0 +1,7 @@
//// [importEmptyFromModuleNotExisted.ts]
import {} from 'module-not-existed'
//// [importEmptyFromModuleNotExisted.js]
"use strict";
exports.__esModule = true;

View File

@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/modules/importEmptyFromModuleNotExisted.ts ===
import {} from 'module-not-existed'
No type information for this code.
No type information for this code.

View File

@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/modules/importEmptyFromModuleNotExisted.ts ===
import {} from 'module-not-existed'
No type information for this code.
No type information for this code.

View File

@ -0,0 +1 @@
import {} from 'module-not-existed'