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
This commit is contained in:
Richard Hulm
2018-04-21 05:31:33 +12:00
committed by Ryan Cavanaugh
parent a7eb125f90
commit 6e4734614d
+3 -2
View File
@@ -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<SourceResponse>;
createToken(options?: TokenOptions): Promise<PatchedTokenResponse>;
}