fix(semantic): TSExportAssignment cannot reference type binding (#4502)

close: #4488
This commit is contained in:
Dunqing 2024-07-27 04:55:03 +00:00
parent 2477330440
commit 36bb6805c6
2 changed files with 15 additions and 1 deletions

View file

@ -1822,6 +1822,13 @@ impl<'a> SemanticBuilder<'a> {
}
}
}
AstKind::TSExportAssignment(export) => {
// export = a;
// ^ can reference value or type
if export.expression.is_identifier_reference() {
self.current_reference_flag = ReferenceFlag::Read | ReferenceFlag::Type;
}
}
AstKind::IdentifierReference(ident) => {
self.reference_identifier(ident);
}

View file

@ -22,7 +22,14 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/equals3-
"id": 0,
"name": "Foo",
"node": "TSInterfaceDeclaration",
"references": []
"references": [
{
"flag": "ReferenceFlag(Read | Type)",
"id": 0,
"name": "Foo",
"node_id": 11
}
]
}
]
}