Skip to content

Commit

Permalink
fix(semantic): TSExportAssignment cannot reference type binding
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Jul 27, 2024
1 parent 1f6b321 commit 4fa4ec6
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 @@ -1807,6 +1807,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 4fa4ec6

Please sign in to comment.