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:
commit
52192006cf
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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'.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [importEmptyFromModuleNotExisted.ts]
|
||||
import {} from 'module-not-existed'
|
||||
|
||||
|
||||
//// [importEmptyFromModuleNotExisted.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
|
@ -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.
|
|
@ -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.
|
|
@ -0,0 +1 @@
|
|||
import {} from 'module-not-existed'
|
Loading…
Reference in a new issue