Skip to content

fix: babel 7.29.13 ternary parsing regression - #3937

Merged
isekovanic merged 1 commit into
developfrom
fix/babel-7-29-13-regression
Nov 5, 2026
Merged

isekovanic merged 1 commit into
developfrom
fix/babel-7-29-13-regression

Conversation

@isekovanic

@isekovanic isekovanic commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🎯 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:

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

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • 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

@Stream-SDK-Bot

Copy link
Copy Markdown
Contributor

SDK Size

title develop branch diff status
js_bundle_size 2038 KB 2038 KB 0 B 🟢
ai_components_size 163 KB 163 KB 0 B 🟢

@isekovanic
isekovanic merged commit dff0b73 into develop Nov 5, 2026
12 of 13 checks passed
@isekovanic
isekovanic deleted the fix/babel-7-29-13-regression branch November 5, 2026 10:01
isekovanic added a commit that referenced this pull request Nov 5, 2026
fix: babel 7.29.13 ternary parsing regression (#3937)
@stream-ci-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 9.11.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants