All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

React Compiler Ported to Rust: Fixing JSON Serialization for Flow Predicate Nodes

By

Joe Savona

3h ago· 11 min readenCode

Summary

This is a GitHub pull request by Joseph Savona that ports the React Compiler from JavaScript/Babel to Rust. The specific change described involves fixing a JSON serialization issue where Babel's parser emits `"predicate": null` on function-like nodes (FunctionDeclaration, ArrowFunctionExpression, etc.) for Flow's `%checks` predicate. The PR applies a custom `nullable_value` deserializer to handle the distinction between "absent" and "explicit null" values, ensuring round-tripped JSON remains byte-equivalent. This is an early, experimental work-in-progress shared for partner feedback before internal testing at Meta.

Key quotes

· 4 pulled
The Babel parser emits `"predicate": null` on function-like nodes (FunctionDeclaration, ArrowFunctionExpression, FunctionExpression, ObjectMethod, DeclareFunction) to signal "no Flow `%checks` predicate".
Plain `Option` deserialization collapses both "absent" and "explicit null" into `None`, and `skip_serializing_if = "Option::is_none"` then drops the field on the way back out, so round-tripped JSON loses the field and byte-equivalent comparison fails.
Apply the existing `crate::common::nullable_value` deserializer to all five predicate fields.
Work-in-progress - we are sharing early, prior to testing internally at Meta, to get feedback from partners...
Snippet from the RSS feed
This is an experimental, work-in-progress port of React Compiler to Rust. Key points: Work-in-progress - we are sharing early, prior to testing internally at Meta, to get feedback from partners in...

You might also wanna read