Options are spread into props.

This commit is contained in:
Thomas Chia
2018-06-02 12:01:59 +08:00
parent efa93ba024
commit d080b3fd44
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ export namespace ReactStripeElements {
interface StripeProviderOptions {
stripeAccount?: string;
}
type StripeProviderProps = { apiKey: string; stripe?: never; options?: StripeProviderOptions } | { apiKey?: never; stripe: StripeProps | null; options?: StripeProviderOptions; };
type StripeProviderProps = { apiKey: string; stripe?: never; } & StripeProviderOptions | { apiKey?: never; stripe: StripeProps | null; } & StripeProviderOptions;
interface StripeProps {
createSource(sourceData?: SourceOptions): Promise<SourceResponse>;
@@ -197,6 +197,7 @@ const TestStripeProviderProps3: React.SFC<{
}> = props => <StripeProvider stripe={null} />;
/**
* StripeProvider should be able to accept an `options` prop
* StripeProvider should be able to accept options.
* See: https://stripe.com/docs/stripe-js/reference#stripe-function for options.
*/
const TestStripeProviderOptions: React.SFC = () => <StripeProvider apiKey="" options={{stripeAccount: ""}} />;
const TestStripeProviderOptions: React.SFC = () => <StripeProvider apiKey="" stripeAccount="" />;