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

Export type for buttons components props #553

Merged
merged 4 commits into from
Aug 13, 2024

Conversation

hnguyen510
Copy link
Contributor

@hnguyen510 hnguyen510 commented Aug 12, 2024

Split up each prop in into its own type to export

// Old way
const styles: PayPalButtonsComponentOptions["styles"] = { ...your_button_styles }

// New way
const styles: PayPalButtonsStyles = { ...your_button_styles }

@hnguyen510 hnguyen510 requested a review from a team as a code owner August 12, 2024 22:13
Copy link

changeset-bot bot commented Aug 12, 2024

🦋 Changeset detected

Latest commit: 36fedc4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@paypal/paypal-js Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@spencersablan spencersablan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to be a great developer experience upgrade for TypeScript devs 😄 Great work.

One comment for conversation ⬇️

@@ -201,122 +201,155 @@ type OnShippingAddressChangeActions = {

export type DisplayOnlyOptions = "vaultable";

export type PayPalButtonCreateOrder = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is totally my fault for putting this in the ticket, but wanted to throw this out there:
Do you think we should prefix these types with PayPalButtons___ instead of PayPalButton___ to match PayPalButtonsComponentOptions? 🤔

Open to either option 😄 But just thought I'd start the conversation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think PayPalButton__ is better since we split them into a single button.

@@ -201,122 +201,155 @@ type OnShippingAddressChangeActions = {

export type DisplayOnlyOptions = "vaultable";

export type PayPalButtonCreateOrder = (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there any discussion around why these types live in paypal-js instead of alongside the components they describe? I'm sure there's some history there, and it's not a blocker on this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know about any discussion around this. Were you thinking of importing it from checkout-components?

@hnguyen510 hnguyen510 merged commit 22f23ab into main Aug 13, 2024
3 checks passed
@hnguyen510 hnguyen510 deleted the Export-type-for-buttons-components-props branch August 13, 2024 20:21
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

Successfully merging this pull request may close these issues.

3 participants