-
Notifications
You must be signed in to change notification settings - Fork 26.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### What? The TypeScript Stripe example has been fixed to address various issues. One of the issues was related to calling a function, which has now been resolved. Additionally, the Stripe API used in the example was outdated, causing an error during the build process. This issue has also been fixed. By making these fixes, the TypeScript Stripe example should now work correctly without any function calling issues or errors related to the outdated Stripe API during the build. ### Why? There's an issue regarding this problem `Fix with typescript stripe example fixes #50541` ```console $ next build - info Linting and checking validity of types ..- error ESLint must be installed in order to run during builds: yarn add --dev eslint - info Linting and checking validity of types ...Failed to compile. ./components/CartSummary.tsx:41:24 Type error: Argument of type '{ sessionId: any; }' is not assignable to parameter of type 'string'. 39 | } 40 | > 41 | redirectToCheckout({ sessionId: response.id }) | ^ 42 | } 43 | 44 | return ( error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ``` ### How? - Calling the `redirectToCheckout` function the right way https://github.com/dayhaysoos/use-shopping-cart/blob/275cb65f3d2fccb15857f4b9278cbbfca11eaf7a/use-shopping-cart/react/index.d.ts#L65 - Updating Stripe API - Fix some changed / depcrated code since the API has changed a little - Fix a TS error since the used library does not has a correct TS defintion file ![image](https://github.com/vercel/next.js/assets/987947/dd21dbb0-e949-4b3e-a26c-6a6d720c6e37) Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
- Loading branch information
Showing
6 changed files
with
27 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
examples/with-stripe-typescript/pages/api/checkout_sessions/[id].ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
examples/with-stripe-typescript/pages/api/payment_intents/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters