From 6e4734614deeb13174de0c7dcd07d85ab0695df7 Mon Sep 17 00:00:00 2001 From: Richard Hulm Date: Fri, 20 Apr 2018 18:31:33 +0100 Subject: [PATCH] react-stripe-elements - Add correct typings to creating a source object (#25169) * Update typings. Ensure the createSource typings are better, using the types from the main stripe package. Also update the injectStripe type to be more flexible in how it can be used, ensuring it allows components with state to be used * Tabs not spaces --- types/react-stripe-elements/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/react-stripe-elements/index.d.ts b/types/react-stripe-elements/index.d.ts index 0ef90dc839..d7cea98728 100644 --- a/types/react-stripe-elements/index.d.ts +++ b/types/react-stripe-elements/index.d.ts @@ -16,6 +16,8 @@ export namespace ReactStripeElements { import ElementsOptions = stripe.elements.ElementsOptions; import TokenOptions = stripe.TokenOptions; import TokenResponse = stripe.TokenResponse; + import SourceResponse = stripe.SourceResponse; + import SourceOptions = stripe.SourceOptions; /** * There's a bug in @types/stripe which defines the property as @@ -28,8 +30,7 @@ export namespace ReactStripeElements { type StripeProviderProps = { apiKey: string; stripe?: never; } | { apiKey?: never; stripe: StripeProps | null; }; interface StripeProps { - // I'm not sure what the definition for this is - createSource(): void; + createSource(sourceData?: SourceOptions): Promise; createToken(options?: TokenOptions): Promise; }