HeadlinesBriefing favicon HeadlinesBriefing.com

React Compiler Switched to Rust Improves AST Fidelity

Hacker News •
×

The React team merged a pull request that ports the experimental React Compiler from JavaScript to Rust. The change replaces the generic Option deserialization for function‑like nodes with a nullable_value helper, preserving explicit `null` predicates in the AST. Round‑trip tests now cover all five predicate fields, removing the need for known‑failure entries. The test script compiler/scripts/test‑babel‑ast.sh reports full parity with the baseline.

The update also restores six Flow match fixtures that were renamed to error.todo‑*. By un‑renaming them and adding Hermes‑parser ≥ 0.28 with the enableExperimentalFlowMatchSyntax flag, the fixtures parse correctly and all six snapshots pass without regeneration. Prettier now formats these files using prettier‑plugin‑hermes‑parser, removing stale ignore rules that caused baseline parse errors. Yarn snap confirms 1,800 passing tests, matching the previous count.

Running the full suite shows 1,782 round‑trip passes, 1,783 scope‑info passes and 1,767 rename checks, matching or exceeding the previous baseline. Cargo tests across 33 suites report zero failures, while TypeScript fixtures now preserve TSImportEqualsDeclaration, TSExportAssignment and TSNamespaceExportDeclaration via a new UnknownStatement variant. The commit solidifies Rust‑based compilation for React, delivering completely reliable AST handling and smoother Flow‑specific syntax support.