fix(isolated-declarations): don't collect references when ExportNamedDeclaration has source (#5926)

This commit is contained in:
Dunqing 2024-09-20 14:19:03 +00:00
parent 756a571432
commit b6a9178075
3 changed files with 5 additions and 1 deletions

View file

@ -137,7 +137,8 @@ impl<'a> Visit<'a> for ScopeTree<'a> {
fn visit_export_named_declaration(&mut self, decl: &ExportNamedDeclaration<'a>) {
if let Some(declaration) = &decl.declaration {
walk_declaration(self, declaration);
} else {
} else if decl.source.is_none() {
// export { ... }
for specifier in &decl.specifiers {
if let Some(name) = specifier.local.identifier_name() {
self.add_type_reference(name.clone());

View file

@ -9,3 +9,5 @@ export const bar: (this: ThisType2) => void = function() {}
import { type InferType1, type InferType2 } from 'infer';
export type F<X extends InferType1> = X extends infer U extends InferType2 ? U : never
export { Unused } from './unused';

View file

@ -12,3 +12,4 @@ export declare function foo(this: ThisType1 ): void;
export declare const bar: (this: ThisType2 ) => void;
import { type InferType1, type InferType2 } from "infer";
export type F<X extends InferType1> = X extends infer U extends InferType2 ? U : never;
export { Unused } from "./unused";