types/stripe-v3: add elements.Elements.getElement (#40970)

This commit is contained in:
hirochachacha
2019-12-13 19:45:33 +09:00
committed by Orta
parent 06d991ed60
commit 9e885fc76c
2 changed files with 8 additions and 0 deletions

View File

@@ -11,6 +11,7 @@
// Thomas Marek <https://github.com/ttmarek>
// Kim Ehrenpohl <https://github.com/kimehrenpohl>
// Krishna Pravin <https://github.com/KrishnaPravin>
// Hiroshi Ioka <https://github.com/hirochachacha>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var Stripe: stripe.StripeStatic;
@@ -702,6 +703,7 @@ declare namespace stripe {
type elementsType = 'card' | 'cardNumber' | 'cardExpiry' | 'cardCvc' | 'postalCode' | 'paymentRequestButton' | 'iban' | 'idealBank';
interface Elements {
create(type: elementsType, options?: ElementsOptions): Element;
getElement(type: elementsType): Element | null;
}
interface ElementsOptions {

View File

@@ -300,4 +300,10 @@ describe("Stripe elements", () => {
}
});
});
it("should get card element", () => {
elements.create('card');
const card = elements.getElement('card');
console.log(card);
});
});