react-stripe-elements icon indicating copy to clipboard operation
react-stripe-elements copied to clipboard

Incomplete types

Open ghost opened this issue 6 years ago • 4 comments

Hello, is there any reason why are the typescript types incomplete in this library? While using the stripe instance I only get suggestions to use properties defined by the following interface coming from the library itself:

    interface StripeProps {
        createSource(sourceData?: SourceOptions): Promise<SourceResponse>;
        createToken(options?: TokenOptions): Promise<PatchedTokenResponse>;
        paymentRequest: stripe.Stripe['paymentRequest'];
        createPaymentMethod(
            paymentMethodType: stripe.paymentMethod.paymentMethodType,
            data?: stripe.CreatePaymentMethodOptions,
        ): Promise<stripe.PaymentMethodResponse>;
        handleCardPayment(
            clientSecret: string,
            options?: stripe.HandleCardPaymentWithoutElementsOptions,
        ): Promise<stripe.PaymentIntentResponse>;
        handleCardSetup(
            clientSecret: string,
            data?: stripe.HandleCardSetupOptions,
        ): Promise<stripe.SetupIntentResponse>;
    }

However, if I console.log the stripe instance, it offers much more:

image

It makes it much harder to follow the official documentation, especially if there are differences even in the existing methods, as mentioned in e.g. #461 . Thank you for the clarification.

ghost avatar Dec 20 '19 09:12 ghost

No info for this?

ghost avatar Dec 23 '19 18:12 ghost

Yeah, types from react-stripe-elements hasn't confirmCardPayment method, that is presented in https://stripe.com/docs/payments/accept-a-payment#web-submit-payment

Burize avatar Dec 27 '19 06:12 Burize

👋 Sorry for the lack of updates on this. We don't own the community maintained types for this project, but we are currently beta testing React Stripe.js, a new library for integrating React and Stripe.js. React Stripe.js includes built-in TypeScript definitions from Stripe. If anyone is interesting in testing out this new library, email [email protected] with your Stripe ID for access to beta documentation.

dweedon-stripe avatar Feb 07 '20 11:02 dweedon-stripe

Closing this as this project has migrated to React Stripe.js as of early 2020, which also has a somewhat different API. If you believe this is still important, please re-open it there.

sashko-stripe avatar Mar 26 '21 18:03 sashko-stripe