Skip to content

Commit 908ddd0

Browse files
committed
fixed missing module resolution errors
1 parent a821a2b commit 908ddd0

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46812,6 +46812,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4681246812
}
4681346813
if (checkExternalImportOrExportDeclaration(node)) {
4681446814
const importClause = node.importClause;
46815+
const moduleExisted = resolveExternalModuleName(node, node.moduleSpecifier);
4681546816
if (importClause && !checkGrammarImportClause(importClause)) {
4681646817
if (importClause.name) {
4681746818
checkImportBinding(importClause);
@@ -46824,11 +46825,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4682446825
checkExternalEmitHelpers(node, ExternalEmitHelpers.ImportStar);
4682546826
}
4682646827
}
46827-
else {
46828-
const moduleExisted = resolveExternalModuleName(node, node.moduleSpecifier);
46829-
if (moduleExisted) {
46830-
forEach(importClause.namedBindings.elements, checkImportBinding);
46831-
}
46828+
else if (moduleExisted) {
46829+
forEach(importClause.namedBindings.elements, checkImportBinding);
4683246830
}
4683346831
}
4683446832
}

tests/baselines/reference/tscWatch/programUpdates/when-changing-`allowImportingTsExtensions`-of-config-file.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false
22
Input::
33
//// [/user/username/projects/myproject/a.ts]
4-
4+
export {};
55

66
//// [/user/username/projects/myproject/b.ts]
77
import "./a.ts";
@@ -47,7 +47,12 @@ DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_mod
4747
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots
4848
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Type roots
4949
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Type roots
50-
[HH:MM:SS AM] Found 0 errors. Watching for file changes.
50+
b.ts:1:8 - error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.
51+
52+
1 import "./a.ts";
53+
   ~~~~~~~~
54+
55+
[HH:MM:SS AM] Found 1 error. Watching for file changes.
5156

5257
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
5358
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory

0 commit comments

Comments
 (0)