Skip to content

React and TypeScript

Stencil generates JSX attribute types in dist/types/components.d.ts. Re-export them for React so <stripe-payment-element> (and the other tags) type-check in TSX.

Add a stripe-pwa-elements-jsx.d.ts file (or append to an existing global types file):

import type { JSX as StripeElementsJSX } from 'stripe-pwa-elements/dist/types/components';
declare module 'react' {
namespace JSX {
interface IntrinsicElements extends StripeElementsJSX.IntrinsicElements {}
}
}

Include that file in your tsconfig.json include array. Import each tag from stripe-pwa-elements/dist/components/<tag> (the lazy loader fails under Vite).

Attach custom events on a ref with addEventListener — React does not reliably fire onFormSubmit for custom elements. See the Agent Skill integration notes for event names.