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

Update Button props to ensure they correctly type check #2445

Merged
merged 8 commits into from
Oct 25, 2022

Conversation

mattcosta7
Copy link
Collaborator

@mattcosta7 mattcosta7 commented Oct 17, 2022

Describe your changes here.

Discussed separately in slack

types for Button were being broadened signficantly because the generic interface exposed by the polymorphic component could not be adequately described by the base forwardRef implementation. Using the PolymorphicForwardRefComponent helper, allows the type fidelity to be maintained.

I've added a type test to validate a few simple cases, and updated places where the types were incorrect in the codebase (now easily noted as failures to build)

One thing to consider - this might be a breaking change for consumers, even though the api should have been this way already

fixes #1956

Screenshots

Please provide before/after screenshots for any visual changes

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@changeset-bot
Copy link

changeset-bot bot commented Oct 17, 2022

🦋 Changeset detected

Latest commit: cc79c6c

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

This PR includes changesets to release 1 package
Name Type
@primer/react 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

@mattcosta7 mattcosta7 temporarily deployed to github-pages October 17, 2022 21:45 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Oct 17, 2022

size-limit report 📦

Path Size
dist/browser.esm.js 78.12 KB (0%)
dist/browser.umd.js 78.77 KB (0%)

@mattcosta7 mattcosta7 changed the title button type check Update Button props to ensure they correctly type check Oct 17, 2022
@mattcosta7 mattcosta7 self-assigned this Oct 17, 2022
@mattcosta7 mattcosta7 marked this pull request as ready for review October 17, 2022 22:09
@mattcosta7 mattcosta7 requested review from a team and siddharthkp October 17, 2022 22:09
@mattcosta7 mattcosta7 temporarily deployed to github-pages October 17, 2022 22:17 Inactive
@mattcosta7
Copy link
Collaborator Author

Not sure why canary release seems to fail

@mattcosta7 mattcosta7 temporarily deployed to github-pages October 19, 2022 17:20 Inactive
@mattcosta7
Copy link
Collaborator Author

I tested the canary build on memex - https://github.com/github/memex/pull/12803

button now properly catches a bunch of type errors that were introduced in that codebase, without any false positives. Feeling pretty confident here

@mattcosta7 mattcosta7 temporarily deployed to github-pages October 20, 2022 14:02 Inactive
@mattcosta7 mattcosta7 temporarily deployed to github-pages October 25, 2022 12:52 Inactive
Copy link
Member

@keithamus keithamus left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@colebemis colebemis left a comment

Choose a reason for hiding this comment

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

🚀

@colebemis colebemis merged commit 6a1a2bd into main Oct 25, 2022
@colebemis colebemis deleted the button-type-check branch October 25, 2022 15:01
@primer-css primer-css mentioned this pull request Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💓collab a vibrant hub of collaboration react
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inaccurate type definitions for Button variant prop
7 participants