Skip to content

fix: babel 7.29.13 ternary parsing regression (#3937) - #3938

Merged
isekovanic merged 1 commit into
mainfrom
develop
Nov 5, 2026
Merged

isekovanic merged 1 commit into
mainfrom
develop

Conversation

@isekovanic

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

🎯 Goal

🛠 Implementation details

🎨 UI Changes

iOS
Before After
Android
Before After

🧪 Testing

☑️ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

## 🎯 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
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Next releases

v9.11.3

9.11.3 (2026-11-05)

Bug Fixes

@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 3544393 into main Nov 5, 2026
20 of 21 checks passed
@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.

3 participants