Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type definition for elements group update-end event #704

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/types/src/valid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ elements.update({
payment_method_types: ['card'],
});

elements.on('update-end', () => {});

const fetchUpdates = async () => {
const {error} = await elements.fetchUpdates();
};
Expand Down
5 changes: 5 additions & 0 deletions types/stripe-js/elements-group.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ export interface StripeElements {
*/
update(options: StripeElementsUpdateOptions): void;

/**
* Triggered when the call to elements.update() is complete.
*/
on(eventType: 'update-end', handler: () => void): void;

/**
* Fetches updates from the associated PaymentIntent or SetupIntent on an existing
* instance of Elements, and reflects these updates in the Payment Element.
Expand Down
Loading