Skip to content

Fix NativeSyntheticEvent compatibility with BaseSyntheticEvent - #58002

Open
97Fakhreddine wants to merge 3 commits into
react:mainfrom
97Fakhreddine:fix/native-synthetic-event-compatibility
Open

Fix NativeSyntheticEvent compatibility with BaseSyntheticEvent#58002
97Fakhreddine wants to merge 3 commits into
react:mainfrom
97Fakhreddine:fix/native-synthetic-event-compatibility

Conversation

@97Fakhreddine

@97Fakhreddine 97Fakhreddine commented Aug 18, 2026

Copy link
Copy Markdown

Summary:

Fixes #57910.

The generated strict TypeScript definition of NativeSyntheticEvent allowed undefined for standard BaseSyntheticEvent fields such as bubbles, cancelable, and defaultPrevented. This made React Native event handlers incompatible with shared handlers accepting React.BaseSyntheticEvent, despite the legacy React Native definition extending that React type directly.

This change aligns the standard event fields with the React synthetic event contract and adds a type test that assigns a React Native event to React.BaseSyntheticEvent. The committed generated API snapshot is updated to match the Flow source.

Changelog:

[GENERAL] [FIXED] - Restore NativeSyntheticEvent compatibility with React BaseSyntheticEvent in the strict TypeScript API

Test Plan:

  • Reproduced the original TS2322 failure with TypeScript 6.0.3 and @types/react 19.2.3.
  • Confirmed the focused strict TypeScript compatibility test passes after the change.
  • Added coverage to packages/react-native/__typetests__/index.tsx.
  • CI: yarn test-generated-typescript

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 18, 2026
@97Fakhreddine 97Fakhreddine changed the title Fix/native synthetic event compatibility Fix NativeSyntheticEvent compatibility with BaseSyntheticEvent Aug 18, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Strict TS API] NativeSyntheticEvent doesn't match BaseSyntheticEvent

1 participant