Repository navigation
fix: babel 7.29.13 ternary parsing regression (#3937) - #3938
Merged
Merged
Conversation
## 🎯 Goal It would appear that `@babel/parser` 7.29.13 (relesed very recently) cannot parse an async arrow function with a return type annotation inside a ternary (`cond ? async (x): T => y : z`), a TypeScript construct that `tsc` and earlier Babel versions accept. This is a Babel regression, tracked in babel/babel#18264, from the 7.x backport #18448. 8.x fails on it too. Metro runs the SDK's TypeScript source through Babel, so a fresh install that resolves 7.29.13 fails to bundle with "Missing semicolon" in `getPhotos.ts` and the app never starts. This affects the current v9 release (9.11.2) and any new project (or ones that upgrade to latest `babel`). Ticket: https://linear.app/stream/issue/RN-512/fresh-installs-fail-to-bundle-babelparser-72913-cannot-parse ## 🛠 Implementation details `getPhotos` in `stream-chat-react-native` and `stream-chat-expo` was defined as `export const getPhotos = Dependency ? async ({ after, first }): Promise<ReturnType> => {...} : null;`. Each is now a named async function plus a plain ternary: ```ts const getPhotosWithDependency = async ({ after, first }): Promise<ReturnType> => {...}; export const getPhotos = Dependency ? getPhotosWithDependency : null; ``` Parentheses around the arrow function would also parse, but Prettier removes them according to our rules so I'll avoid changing those now. ## 🎨 UI Changes / ## 🧪 Testing / ## ☑️ Checklist - [x] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (required) - [x] PR targets the `develop` branch - [x] Documentation is updated (not needed) - [ ] New code is tested in main example apps, including all possible scenarios - [ ] SampleApp iOS and Android - [ ] Expo iOS and Android
Next releasesv9.11.39.11.3 (2026-11-05)Bug Fixes
|
Contributor
SDK Size
|
Contributor
|
🎉 This PR is included in version 9.11.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Goal
It would appear that
@babel/parser7.29.13 (relesed very recently) cannot parse an async arrow function with a return type annotation inside a ternary (cond ? async (x): T => y : z), a TypeScript construct thattscandearlier Babel versions accept. This is a Babel regression, tracked in babel/babel#18264, from the 7.x
backport #18448. 8.x fails on it too.
Metro runs the SDK's TypeScript source through Babel, so a fresh install that resolves 7.29.13 fails to
bundle with "Missing semicolon" in
getPhotos.tsand the app never starts. This affects the currentv9 release (9.11.2) and any new project (or ones that upgrade to latest
babel).Ticket:
https://linear.app/stream/issue/RN-512/fresh-installs-fail-to-bundle-babelparser-72913-cannot-parse
🛠 Implementation details
getPhotosinstream-chat-react-nativeandstream-chat-expowas defined asexport const getPhotos = Dependency ? async ({ after, first }): Promise<ReturnType> => {...} : null;.Each is now a named async function plus a plain ternary:
Parentheses around the arrow function would also parse, but Prettier removes them according to our rules so I'll avoid changing those now.
🎨 UI Changes
/
🧪 Testing
/
☑️ Checklist
developbranch🎯 Goal
🛠 Implementation details
🎨 UI Changes
iOS
Android
🧪 Testing
☑️ Checklist
developbranch