Closed Rashita123 closed 2 years ago
✔️ Deploy Preview for evergreen-storybook ready!
🔨 Explore the source changes: 3a9410f927ec94cda7680b2ecc1360f75c81286a
🔍 Inspect the deploy log: https://app.netlify.com/sites/evergreen-storybook/deploys/61eb0c6919aebd0007af3259
😎 Browse the preview: https://deploy-preview-1394--evergreen-storybook.netlify.app
Overview This PR is for this issue #1390. The MenuItem component does not accept String type values, while all the examples in the docs say that it does! Made a change to its prop types that should solve this issue.
Issue:
This demonstrates the issue. It throws an error if 'String' value is passed as 'secondaryText' to 'ModalItem'. Note: This example is importing and using evergreen component.
Solution:
Open this sandbox
Step1:
Open the App.tsx file and see passing string value to 'secondaryText' throws an error.
Step2:
Now go to MenuItem.tsx. The custom component is defined here. I tried to reproduce the actual component but at a very basic level. But, the role of types can be understood.
Step3:
Comment lIne 4 and un-comment Line 5.
The error is gone! Because the type String is added to the type declaration for secondaryText.
This is what my PR solves.
Documentation