Skip to content

Commit

Permalink
fix(semantic): TSExportAssignment cannot reference type binding (#4502
Browse files Browse the repository at this point in the history
)

close: #4488
  • Loading branch information
Dunqing committed Jul 27, 2024
1 parent 2477330 commit 36bb680
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
}
Expand Down

0 comments on commit 36bb680

Please sign in to comment.