Skip to content

Commit 8795b75

Browse files
authored
Fix #21641, Add indirect location for default imports for synthetic defaults (#21703) (#21746)
1 parent 4c89376 commit 8795b75

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/services/importTracker.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ namespace ts.FindAllReferences {
107107
if (namedBindings && namedBindings.kind === SyntaxKind.NamespaceImport) {
108108
handleNamespaceImport(direct, namedBindings.name);
109109
}
110+
else if (isDefaultImport(direct)) {
111+
const sourceFileLike = getSourceFileLikeForImportDeclaration(direct);
112+
addIndirectUser(sourceFileLike); // Add a check for indirect uses to handle synthetic default imports
113+
directImports.push(direct);
114+
}
110115
else {
111116
directImports.push(direct);
112117
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// @esModuleInterop: true
2+
3+
// @Filename: /abc.d.ts
4+
////declare module "a" {
5+
//// export const [|x|]: number;
6+
////}
7+
8+
// @Filename: /b.ts
9+
////import * as a from "a";
10+
////a.[|x|];
11+
12+
verify.rangesReferenceEachOther();

0 commit comments

Comments
 (0)