Latest Results
fix(es/parser): parse key Flow forms from #11729 (phase 1) (#11733)
## Summary
This is **Phase 1** for #11729 and focuses on the highest-impact Flow
parser gaps seen in the React Native reproduction.
- Parse typed arrow params with trailing comma in Flow (`(x: T,) =>
...`)
- Parse nullable anonymous function types (`?() => R`, `?(x: T) => R`,
`?(...A) => R`)
- Allow trailing comma in Flow mapped type members (`{ [K in keyof T]:
T[K], }`)
## Changes
- `crates/swc_ecma_parser/src/parser/expr.rs`
- In `parse_args_or_pats`, consume delimiter/trailing comma before the
Flow type-cast fast-path `continue`.
- `crates/swc_ecma_parser/src/parser/typescript.rs`
- In Flow nullable type parsing, when `?` is followed by `(`, parse
using `parse_ts_non_conditional_type` so function types are accepted.
- In `parse_ts_mapped_type`, allow optional trailing comma after mapped
member type annotation in Flow mode.
- Added fixtures:
- `tests/flow/issue-11729-arrow-trailing-comma`
- `tests/flow/issue-11729-nullable-anon-fn`
- `tests/flow/issue-11729-mapped-type-trailing-comma`
## Validation
- `git submodule update --init --recursive`
- `UPDATE=1 cargo test -p swc_ecma_parser`
- `cargo test -p swc_ecma_parser`
- `UPDATE=1 cargo test -p swc_ecma_parser --features flow --test flow --
--ignored`
- `cargo test -p swc_ecma_parser --features flow --test flow --
--ignored`
- `cargo fmt --all`
- `cargo clippy --all --all-targets -- -D warnings`
## Scope note
This PR intentionally leaves the remaining Phase 2 items out of scope
(e.g. `@@iterator`, advanced anonymous parameter signature cases,
component rest-object forms). Latest Branches
0%
0%
kdy1/react-compiler-m1-finalize 0%
kdy1/fix-11729-flow-phase1 © 2026 CodSpeed Technology