stripe-v3: update typing for idealbankelement

This commit is contained in:
Rik Moedt
2019-04-11 11:38:25 +02:00
parent cd642cb051
commit b210980a48
2 changed files with 10 additions and 3 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for stripe-v3 3.0
// Type definitions for stripe-v3 3.1
// Project: https://stripe.com/
// Definitions by: Andy Hawkins <https://github.com/a904guy/,http://a904guy.com>
// Eric J. Smith <https://github.com/ejsmith>
@@ -314,7 +314,7 @@ declare namespace stripe {
brand: string;
complete: boolean;
empty: boolean;
value?: { postalCode: string | number };
value?: { postalCode: string | number } | string;
country?: string;
bankName?: string;
error?: Error;
@@ -325,7 +325,7 @@ declare namespace stripe {
locale?: string;
}
type elementsType = 'card' | 'cardNumber' | 'cardExpiry' | 'cardCvc' | 'postalCode' | 'paymentRequestButton' | 'iban';
type elementsType = 'card' | 'cardNumber' | 'cardExpiry' | 'cardCvc' | 'postalCode' | 'paymentRequestButton' | 'iban' | 'idealBank';
interface Elements {
create(type: elementsType, options?: ElementsOptions): Element;
}
+7
View File
@@ -218,5 +218,12 @@ describe("Stripe v2 & v3", () => {
supportedCountries: ['SEPA'],
placeholderCountry: 'AT'
});
const idealBank = elements.create('idealBank');
idealBank.on('change', (resp: stripe.elements.ElementChangeResponse) => {
if (resp.value && typeof resp.value !== 'object') {
console.log(resp.value.length);
const string: string = resp.value;
}
});
});
});