Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript error when children are passed into the StripeCheckout component #158

Open
TheChrisader opened this issue Sep 7, 2022 · 2 comments

Comments

@TheChrisader
Copy link

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch react-stripe-checkout@2.6.3 for the project I'm working on.

Description

Passing children into the StripeCheckout component generates an error when using Typescript. I know this is not an intended feature because the documentation states that the component accepts children components.

So I took a quick glance, and apparently there is no type definition for children props in the StripeCheckout interface, hence the error.

Here is the diff that solved my problem:

diff --git a/node_modules/react-stripe-checkout/index.d.ts b/node_modules/react-stripe-checkout/index.d.ts
index 5e0fe31..097eb25 100644
--- a/node_modules/react-stripe-checkout/index.d.ts
+++ b/node_modules/react-stripe-checkout/index.d.ts
@@ -37,6 +37,7 @@ declare module "react-stripe-checkout" {
     }
 
     export interface StripeCheckoutProps {
+        children?: React.ReactNode;
         token: (token: Token) => void;
         stripeKey: string;
         label?: string;

It's a pretty small, easily fixable issue, so I'd like to make a pull request if this isn't already being taken care of.

This issue body was partially generated by patch-package.

@enesien
Copy link

enesien commented Sep 7, 2023

Feel free to use my fork with updated types: https://github.com/enesien/react-stripe-checkout-nsen

npm i react-stripe-checkout-nsen

@Paviter-Singh
Copy link

Its April 2024 and issue is not resolve馃槄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants