Merge pull request #20671 from Kingwl/fix-import-not-existed-module

error if import empty object form module not existed
This commit is contained in:
Mohamed Hegazy 2018-04-17 17:29:07 -07:00 committed by GitHub
commit 52192006cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 1 deletions

View file

@ -24465,7 +24465,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'