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

refactor(UserAvatar): convert to typescript #5771

Merged
merged 2 commits into from
Aug 1, 2024

Conversation

anamikaanu96
Copy link
Contributor

Closes #5672

Add Typescript types to UserAvatar

What did you change? Converted packages/ibm-products/src/components/UserAvatar/UserAvatar.js to packages/ibm-products/src/components/UserAvatar/UserAvatar.tsx

How did you test and verify your work? storybook

@anamikaanu96 anamikaanu96 requested a review from a team as a code owner July 31, 2024 08:59
@anamikaanu96 anamikaanu96 requested review from AlexanderMelox and devadula-nandan and removed request for a team July 31, 2024 08:59
@anamikaanu96 anamikaanu96 enabled auto-merge July 31, 2024 08:59
Copy link

netlify bot commented Jul 31, 2024

Deploy Preview for carbon-for-ibm-products ready!

Name Link
🔨 Latest commit ed9e9c4
🔍 Latest deploy log https://app.netlify.com/sites/carbon-for-ibm-products/deploys/66ab327efdbf100008d1cd3c
😎 Deploy Preview https://deploy-preview-5771--carbon-for-ibm-products.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.

Comment on lines +58 to +72
type ImageProps =
| {
/**
* When passing the image prop, supply a full path to the image to be displayed.
*/
image: string;
/**
* When passing the image prop use the imageDescription prop to describe the image for screen reader.
*/
imageDescription: string;
}
| {
image?: never;
imageDescription?: never;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @anamikaanu96 , I'm not sure why we need the never types optionally in the second object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @AlexanderMelox Thanks for reviewing! Its because
imageDescription: PropTypes.string.isRequired.if(({ image }) => !!image),
if image prop is not present we don't require imageDescription.

@anamikaanu96 anamikaanu96 added this pull request to the merge queue Aug 1, 2024
Merged via the queue into carbon-design-system:main with commit 81d820d Aug 1, 2024
19 checks passed
@anamikaanu96 anamikaanu96 deleted the userAvatarTsx branch August 1, 2024 07:57
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 UserAvatar
3 participants