Skip to content

Fix React 19 JSX type compatibility - #579

Merged
andrewiggins merged 1 commit into
Shopify:mainfrom
HamedFarazi:fix/react-19-types
Aug 28, 2026
Merged

Fix React 19 JSX type compatibility#579
andrewiggins merged 1 commit into
Shopify:mainfrom
HamedFarazi:fix/react-19-types

Conversation

@HamedFarazi

Copy link
Copy Markdown
Contributor

Summary

Fixes #505

This PR updates the JSX type declarations in @shopify/app-bridge-react to support React 19 while preserving compatibility with existing React 18 applications.

Problem

The App Bridge React components currently augment JSX intrinsic elements through the global JSX namespace:

declare global {
  namespace JSX {
    interface IntrinsicElements {
      'ui-modal': ...
    }
  }
}

With React 19, the JSX namespace is scoped to the react module. As a result, these custom App Bridge web components are no longer correctly recognized by TypeScript when used with React 19.

This can lead to type errors when using components such as:

<ui-modal />
<ui-nav-menu />
<ui-save-bar />
<ui-title-bar />

Solution

Replace the global JSX declaration with React module augmentation:

declare module 'react' {
  namespace JSX {
    interface IntrinsicElements {
      'ui-modal': ...
    }
  }
}

The existing ref typing is preserved using import('react').LegacyRef, avoiding unnecessary direct type imports.

The change has been applied consistently to:

Modal
NavMenu
SaveBar
TitleBar
Compatibility

The implementation remains compatible with React 18 while enabling the expected JSX type resolution for React 19.

The existing App Bridge web component attributes and ref types are preserved.

Verification

The following checks pass successfully:

pnpm run type-check ✅
pnpm run lint ✅
pnpm run test ✅
git diff --check ✅
Manual JSX type verification with React 18 types ✅

No runtime behavior is changed by this PR; this is a TypeScript/JSX type compatibility fix.

Changeset

Added a patch changeset for @shopify/app-bridge-react.

@HamedFarazi
HamedFarazi requested a review from a team August 26, 2026 08:17

@andrewiggins andrewiggins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@andrewiggins
andrewiggins merged commit b61cda8 into Shopify:main Aug 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

React 19 types support

2 participants