React-stripe-elements: Incomplete types

Created on 20 Dec 2019  路  4Comments  路  Source: stripe/react-stripe-elements

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.

Most helpful comment

馃憢 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.

All 4 comments

No info for this?

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

馃憢 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.

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.

Was this page helpful?
0 / 5 - 0 ratings