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

chore: fix Primitive types #4011

Merged
merged 20 commits into from
Jun 6, 2023
Merged

chore: fix Primitive types #4011

merged 20 commits into from
Jun 6, 2023

Conversation

zchenwei
Copy link
Contributor

@zchenwei zchenwei commented May 31, 2023

Description of changes

This PR aims to fix the component types to provide typescript users with better type hints.

The PR does the following things:

  • Update component props to include the underlying HTML attributes and keep the custom props in a base interface. For example, BaseButtonProps includes only the custom props defined by ourselves while ButtonProps includes the custom props plus all button HTML attributes.
  • Use the new types to simply typings and fix type errors in other react packages that get caught by the typed View component.
  • Deprecate to prop on Link primitive as part of the clean up

For code reviewers, the major changes are in view.ts under the types folder and the rest of them is just boiler plate updates accordingly.

  • Replace the util types with those from react types out of the box
  • Create an interface that extends the return type of React.forwardRef and overload the JSX constructor to support polymorphic components with as prop by taking generics.

Follow-ups that we want to tackle:

  • Update components prop to explicitly define children prop if necessary for future proof since its implicit declaration has been removed in the latest react types. The PR adds children prop to BaseComponentProps to maintain the same behavior as usual and will not address it altogether considering the scope and priority.

Issue #, if available

Button

flex

view

Description of how you validated changes

Checklist

  • Have read the Pull Request Guidelines
  • PR description included
  • Relevant documentation is changed or added (and PR referenced)
  • yarn test passes and tests are updated/added
  • No side effects or sideEffects field updated

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@changeset-bot
Copy link

changeset-bot bot commented May 31, 2023

⚠️ No Changeset found

Latest commit: c97954a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@reesscot reesscot changed the base branch from main to next-release/main May 31, 2023 19:36
@zchenwei zchenwei temporarily deployed to ci May 31, 2023 22:41 — with GitHub Actions Inactive
@zchenwei zchenwei temporarily deployed to ci May 31, 2023 22:41 — with GitHub Actions Inactive
@zchenwei zchenwei temporarily deployed to ci May 31, 2023 22:41 — with GitHub Actions Inactive
@zchenwei zchenwei temporarily deployed to ci May 31, 2023 22:41 — with GitHub Actions Inactive
@zchenwei zchenwei marked this pull request as ready for review May 31, 2023 22:57
@zchenwei zchenwei requested a review from a team as a code owner May 31, 2023 22:57
@zchenwei zchenwei temporarily deployed to ci June 4, 2023 01:10 — with GitHub Actions Inactive
@zchenwei zchenwei temporarily deployed to ci June 4, 2023 01:10 — with GitHub Actions Inactive
@zchenwei zchenwei temporarily deployed to ci June 4, 2023 01:10 — with GitHub Actions Inactive
@zchenwei zchenwei temporarily deployed to ci June 5, 2023 18:50 — with GitHub Actions Inactive
@zchenwei zchenwei temporarily deployed to ci June 5, 2023 18:50 — with GitHub Actions Inactive
@zchenwei zchenwei temporarily deployed to ci June 5, 2023 18:50 — with GitHub Actions Inactive
@zchenwei zchenwei temporarily deployed to ci June 5, 2023 18:50 — with GitHub Actions Inactive
@zchenwei zchenwei temporarily deployed to ci June 5, 2023 19:22 — with GitHub Actions Inactive
@zchenwei zchenwei temporarily deployed to ci June 5, 2023 19:22 — with GitHub Actions Inactive
@zchenwei zchenwei temporarily deployed to ci June 5, 2023 19:22 — with GitHub Actions Inactive
@zchenwei zchenwei temporarily deployed to ci June 5, 2023 19:22 — with GitHub Actions Inactive
Copy link
Member

@calebpollman calebpollman left a comment

Choose a reason for hiding this comment

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

🚢

@zchenwei zchenwei merged commit 0148015 into next-release/main Jun 6, 2023
@zchenwei zchenwei deleted the chenwz-dev-viewtypes branch June 6, 2023 00:03
This was referenced Jun 6, 2023
@github-actions github-actions bot mentioned this pull request Jun 7, 2023
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