Skip to content

Commit

Permalink
Add type definition for elements group update-end event (#704)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlande-stripe authored Jan 2, 2025
1 parent cf55c17 commit d251532
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
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

0 comments on commit d251532

Please sign in to comment.