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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Type and Docs not sync #580

Open
OrbisK opened this issue Nov 19, 2024 · 0 comments
Open

[Bug] Type and Docs not sync #580

OrbisK opened this issue Nov 19, 2024 · 0 comments

Comments

@OrbisK
Copy link

OrbisK commented Nov 19, 2024

Library used

'@paypal/paypal-js' (for types) script-tag

🐞 Describe the Bug

Docs and types are not in sync

🔬 Minimal Reproduction

const cardFieldsOptions : PayPalCardFieldsComponentOptions = {
    // actions are in docs example but not within types
    //                               vvvvvv  https://developer.paypal.com/sdk/js/reference/#link-requestcaptureorderfromserver
    onApprove: (data, actions)=>{}
    // onCancel is documented but not in types
    // vvvvvvv can't link to it, because links are broken (see screenshot 1)
    onCancel: () => {}
}
const fields = paypal.CardFields.(cardFieldsOptions)
// example from docs https://developer.paypal.com/sdk/js/reference/#link-requestcreateorderfromserver
const onApprove = (data, actions) => {
    return fetch('/api/paypal/order/capture', {
        method: 'POST',
        body: JSON.stringify({
            orderID: data.orderID
        })
    }).then(res => {
        return res.json();
    }).then(json => {
        // Show a success page
    });
};
// this example does return a promise with data. type for onApprove is not a Promise, its just void

😕 Actual Behavior

see above

🤔 Expected Behavior

Not sure whats the right behavior, i guess types are right, and docs wrong?

🌍 Environment

  • Node.js/npm: 22 + pnpm latest
  • OS: ubuntu 24
  • Browser: chrome latest

➕ Additional Context

image

The sdk docs are a little broken. most links:
image

exists at least twice and always link to the first one.

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

1 participant