Skip to content

Commit 153e032

Browse files
committed
fix(semantic): fix reference type flags when visiting TSImportType
1 parent 0eaebcd commit 153e032

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

crates/oxc_linter/src/rules/eslint/no_undef.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ fn test() {
172172
("function resolve<T>(path: string): T { return { path } as T; }", None, None),
173173
("let xyz: NodeListOf<HTMLElement>", None, None),
174174
("type Foo = Record<string, unknown>;", None, None),
175+
(
176+
"export interface StoreImpl { onOutputBlobs: (callback: (blobs: MediaSetBlobs) => void) => import('rxjs').Subscription; }",
177+
None,
178+
None,
179+
),
175180
];
176181

177182
let fail = vec![

crates/oxc_semantic/src/builder.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,6 +1368,24 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
13681368
self.leave_node(kind);
13691369
}
13701370

1371+
fn visit_ts_import_type(&mut self, it: &TSImportType<'a>) {
1372+
let kind = AstKind::TSImportType(self.alloc(it));
1373+
self.current_reference_flags = ReferenceFlags::Type;
1374+
self.enter_node(kind);
1375+
self.visit_span(&it.span);
1376+
self.visit_ts_type(&it.argument);
1377+
if let Some(options) = &it.options {
1378+
self.visit_object_expression(options);
1379+
}
1380+
if let Some(qualifier) = &it.qualifier {
1381+
self.visit_ts_type_name(qualifier);
1382+
}
1383+
if let Some(type_arguments) = &it.type_arguments {
1384+
self.visit_ts_type_parameter_instantiation(type_arguments);
1385+
}
1386+
self.leave_node(kind);
1387+
}
1388+
13711389
fn visit_throw_statement(&mut self, stmt: &ThrowStatement<'a>) {
13721390
let kind = AstKind::ThrowStatement(self.alloc(stmt));
13731391
self.enter_node(kind);

0 commit comments

Comments
 (0)