Luehang / react-paypal-button-v2

An easy and simple to use React button component to implement PayPal Checkout with Smart Payment Buttons V2 (Version 2).
https://luehangs.site/lue_hang/projects/react-paypal-button-v2
MIT License
274 stars 81 forks source link

[BUG] Type missing onClick, onCancel functions #86

Open thuonghd3 opened 3 years ago

thuonghd3 commented 3 years ago

To Do First

Software Package Version:

Describe the bug

To Reproduce

Expected behavior

Screenshots

Desktop (please complete the following information):

Additional context

kshitijmehta commented 3 years ago

👍

architgarg commented 3 years ago

onShippingChange types are also missing!

thuonghdbhsoft commented 3 years ago

I resolved it, create file paypal_extends.d.ts

import { PayPalButtonProps } from "react-paypal-button-v2/dist/index";

declare module "react-paypal-button-v2/dist/index" {
    interface PayPalButtonProps {
        onCancel?: Function,
        onClick?: Function,
    }
}

In the file tsconfig.json

Add a new line:

"include": [
    ...
    "lib/view/components/paypal/paypal_extends.d.ts",
    ...
  ]