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

feat: add types to RadioTile #15984

Merged
merged 3 commits into from Mar 21, 2024

Conversation

cuppajoey
Copy link
Contributor

@cuppajoey cuppajoey commented Mar 16, 2024

Closes #13572

This PR supersedes #14901 and addresses the type errors found in review.

Converts RadioTile to Typescript. Add/exports newly added types.

Changelog

New

  • Rename RadioTile.jsRadioTile.tsx and RadioTile/index.js to RadioTile/index.ts.
  • Introduce and export interface RadioTileProps.

Changed

  • Normalize PropType descriptions with similar components. The previous descriptions were inconsistent and did not match the format of other similar components (e.g., TileGroup, RadioButton, Select, etc..).

For example, most other PropType descriptions begin with "Provide an optional..." or "Specify whether 'X' should be disabled".

Testing / Reviewing

  • Verify new types match the component's PropTypes.
  • Check for Type errors.
  • Confirm new PropType descriptions match the common format of similar components.

Changes:
- Convert `RadioTile` to Typescript and add types.
- Add export for new interface `RadioTileProps`.
- Normalize PropType descriptions with similar components.
@cuppajoey cuppajoey requested a review from a team as a code owner March 16, 2024 04:00
Copy link
Contributor

github-actions bot commented Mar 16, 2024

DCO Assistant Lite bot All contributors have signed the DCO.

@@ -99,27 +164,27 @@ const RadioTile = React.forwardRef(function RadioTile(

RadioTile.propTypes = {
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 took the liberty of updated these prop descriptions to better match the writing style of other components (e.g., TileGroup, Select, etc..). If you feel this is out of scope for this PR, I don't mind reverting these changes.


export default RadioTile;
export { RadioTile };

export type { RadioTileProps };
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 noticed that many of the recently added types don't export their interface. I'm not sure if there is a good reason not to, but I decided to include it.

This matches the original implementation from DefinitelyTyped and the current export for Checkbox

@cuppajoey
Copy link
Contributor Author

I have read the DCO document and I hereby sign the DCO.

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

Looks good, thank you! 🙏 I think re-running the all contributors script should fix the conflicts.

Copy link

netlify bot commented Mar 19, 2024

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit da0a29c
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/65f9c33a983f180008942189
😎 Deploy Preview https://deploy-preview-15984--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@cuppajoey
Copy link
Contributor Author

@tw15egan I'm going to push up one more commit to fix the description for props.light. Will that conflict with what you are doing?

@tw15egan
Copy link
Member

@cuppajoey No thats fine, I just updated the all-contributors for you 👍

Copy link
Member

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

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

LGTM 👍 ✅

@tw15egan tw15egan added this pull request to the merge queue Mar 21, 2024
Merged via the queue into carbon-design-system:main with commit 9d445e1 Mar 21, 2024
20 checks passed
preetibansalui pushed a commit to tay1orjones/carbon that referenced this pull request Apr 24, 2024
* feat: add types to `RadioTile`

Changes:
- Convert `RadioTile` to Typescript and add types.
- Add export for new interface `RadioTileProps`.
- Normalize PropType descriptions with similar components.

* docs: fix typos in `propTypes.light` description

---------

Co-authored-by: TJ Egan <tw15egan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add TypeScript types to RadioTile
4 participants