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

Add TypeScript annotations to MultiSelect #13144

Merged
merged 7 commits into from
Feb 23, 2023

Conversation

awarrier99
Copy link
Contributor

@awarrier99 awarrier99 commented Feb 13, 2023

Closes #12547

Convert existing propType definitions to TypeScript annotations on the MultiSelect component. This is part of a broader effort to add TypeScript annotations to components, tracked in #12513.

Changelog

Changed

  • MultiSelect.js has been converted to MultiSelect.tsx
  • Added awarrier99 to contributor list
  • Changed a MultiSelect story to include required prop label
  • Changed a MultiSelect test to return an empty span instead of an empty string for itemToElement (a string is not valid as a JSX constructor, which is how the prop is used in the component)
  • Changed MultiSelect sorting options to use locale prop, rather than hardcoded 'en'

Testing / Reviewing

  • In the packages/react directory, run yarn build, yarn storybook. In the storybook, navigate to MultiSelect and confirm that the component's behavior remains unchanged.
  • In MultiSelect.stories.js and MultiSelect-test.js, add // @ts-check as the first line in the file (temporarily, for the sake of this test). Confirm that the files do not have compilation errors (related to the MultiSelect component). Make changes to the components in those files - change number to string, etc - and confirm that compilation errors appear.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2023

DCO Assistant Lite bot All contributors have signed the DCO.

@awarrier99
Copy link
Contributor Author

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

@netlify
Copy link

netlify bot commented Feb 13, 2023

Deploy Preview for carbon-components-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 2e58fa5
🔍 Latest deploy log https://app.netlify.com/sites/carbon-components-react/deploys/63eac354a755c200080f1785
😎 Deploy Preview https://deploy-preview-13144--carbon-components-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 settings.

@netlify
Copy link

netlify bot commented Feb 13, 2023

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 2e58fa5
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/63eac3548a02a10008377700
😎 Deploy Preview https://deploy-preview-13144--carbon-elements.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 settings.

@netlify
Copy link

netlify bot commented Feb 13, 2023

Deploy Preview for carbon-components-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 1e8f276
🔍 Latest deploy log https://app.netlify.com/sites/carbon-components-react/deploys/63f7ef080ff7a800071a908a
😎 Deploy Preview https://deploy-preview-13144--carbon-components-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 settings.

@netlify
Copy link

netlify bot commented Feb 13, 2023

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit f48a21d
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/63ec115a7da04100084f1f17
😎 Deploy Preview https://deploy-preview-13144--carbon-elements.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 settings.

@andreancardona
Copy link
Contributor

@awarrier99 Thank you so much for the contribution! Do you mind resolving the merge conflicts please :)

@awarrier99
Copy link
Contributor Author

@awarrier99 Thank you so much for the contribution! Do you mind resolving the merge conflicts please :)

@andreancardona Sure, they should be resolved now!

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 once the all-contributors merge conflict is fixed! 👍 ✅

@awarrier99
Copy link
Contributor Author

LGTM once the all-contributors merge conflict is fixed! 👍 ✅

Resolved!

@awarrier99
Copy link
Contributor Author

@andreancardona @tw15egan I noticed with the previous run of the workflows that there was an error with a snapshot saying that the public API shouldn't be changed without a new semver bump - do I need to do something to resolve that?

@tw15egan
Copy link
Member

tw15egan commented Feb 22, 2023

@awarrier99 usually means snapshots need to be updated due to the changes made. If the changes are intentional (in this case, yes we are modifying the component footprint quite a bit), you can update snapshots with yarn test -u. None of these changes should be breaking so we are good to go 👍🏻

@awarrier99
Copy link
Contributor Author

@awarrier99 usually means snapshots need to be updated due to the changes made. If the changes are intentional (in this case, yes we are modifying the component footprint quite a bit), you can update snapshots with yarn test -u. None of these changes should be breaking so we are good to go 👍🏻

Got it, sounds good! I'll leave the snapshots as is then

@tw15egan tw15egan requested a review from a team as a code owner February 22, 2023 22:46
@awarrier99
Copy link
Contributor Author

@tw15egan sorry I misunderstood, I thought you were saying we were good to go without needing to update the snaps - thanks for taking care of that

@tw15egan
Copy link
Member

@awarrier99, no worries, I could have worded it better! I just meant it was okay to update them because we are knowingly making changes to the API 👍🏻 Thanks for contributing 🎉

awarrier99 and others added 3 commits February 23, 2023 11:10
Convert existing propType definitions to Typescript annotations on the
MultiSelect component. This is part of a broader effort to add
Typescript annotations to components, tracked in carbon-design-system#12513.
Closes carbon-design-system#12547.

Only type annotations, no breaking feature changes
Convert existing propType definitions to Typescript annotations on the
MultiSelect component. This is part of a broader effort to add
Typescript annotations to components, tracked in carbon-design-system#12513.
Closes carbon-design-system#12547.

Only type annotations, no breaking feature changes
@@ -4820,127 +4820,10 @@ Map {
"type": "bool",
},
"downshiftProps": Object {
"args": Array [
Copy link
Member

Choose a reason for hiding this comment

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

@awarrier99 circling back, is there a way to retain the downshiftProps here? Looking at the Dropdown ts conversion, I do not see any snapshot changes to the downshiftProps. I'm trying to parse the difference in implementation to see what may be causing it 🤔

Reference PR: https://github.com/carbon-design-system/carbon/pull/13022/files

Copy link
Member

Choose a reason for hiding this comment

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

The other snapshot changes are intentional and are fine 👍🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, let me take a look at this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tw15egan this should be resolved now - I had changed the prop type to match what was in the Dropdown component originally, but I've now reverted that change

@kodiakhq kodiakhq bot merged commit d791865 into carbon-design-system:main Feb 23, 2023
@awarrier99 awarrier99 deleted the add-multiselect-types branch February 23, 2023 23:34
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 MultiSelect
3 participants