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

Components: Simplify CustomGradientPicker's utility props #49588

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

chad1008
Copy link
Contributor

@chad1008 chad1008 commented Apr 4, 2023

What?

When recently migrating CustomGradientPicker to TypeScript, an abstraction was used that is more complicated than it needed to be. This PR simplifies the affected types.

Why?

Simplifying these types will make them easier to parse and work with by other contributors in the future.

How?

The utility function impacted by this change uses only certain props from an existing type. The abstraction that is currently in place narrows the existing type to more closely match the expected inputs of the function, but this narrowing isn't technically necessary. To alleviate the added complexity, the types are being updated to just accept the existing type, and the extra prop(s) can be seamlessly ignored without causing any errors.

Testing Instructions

  • Confirm that there are new new TS errors introduced by this change
  • Confirm unit tests pass

@chad1008 chad1008 changed the title Components: Simplify CustomGradientPicker's serializer props Components: Simplify CustomGradientPicker's utility props Apr 4, 2023
@chad1008 chad1008 requested a review from ciampo April 4, 2023 19:34
@chad1008 chad1008 self-assigned this Apr 4, 2023
@chad1008 chad1008 added the [Package] Components /packages/components label Apr 4, 2023
@chad1008 chad1008 added the [Type] Code Quality Issues or PRs that relate to code quality label Apr 4, 2023
@chad1008 chad1008 marked this pull request as ready for review April 4, 2023 19:34
@chad1008 chad1008 requested a review from ajitbohra as a code owner April 4, 2023 19:34
@chad1008 chad1008 requested a review from mcsf April 4, 2023 19:36
@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Flaky tests detected in 948e5b5.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4611585556
📝 Reported issues:

Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

🚀

Thank you and @mcsf for always looking for ways to make our code better ❤️

@ciampo ciampo merged commit 89d5743 into trunk Apr 5, 2023
@ciampo ciampo deleted the simplify-color-picker-types branch April 5, 2023 07:21
@github-actions github-actions bot added this to the Gutenberg 15.6 milestone Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants