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(component): Convert SideNavItems.js to SideNavItems.tsx #14861

Closed
wants to merge 5 commits into from

Conversation

Nirajsah
Copy link
Contributor

@Nirajsah Nirajsah commented Oct 11, 2023

Closes #13603

Detailed Description

  • In this pull request, I have introduced a new component file, SideNavItems.tsx, along with corresponding TypeScript types to enhance type safety. During the development of this component, I encountered two issues. first issue was related to propTypes, which I removed in earlier commits i found that it is required. Additionally, there was an issue related to TypeScript's ability to correctly infer types, particularly with regards to (child.type?.displayName).

To resolve the issue with TypeScript's type inference, I implemented a solution by explicitly defining the child's type as React.ComponentType. I then checked whether the displayName property existed within childType. This approach ensured that TypeScript correctly recognized and inferred the types, effectively resolving the issue.

In previous PRs, I unintentionally omitted running the tests before making the commits. I acknowledge and apologise for this oversight. All test suites were successful.

New

  • Added a new file SideNavItems.tsx along with its corresponding TypeScript types. Issue Resolution

Changed

  • SideNavItems.js to SideNavItems.tsx

Removed

  • None

It's important to note that all other aspects of the SideNavItems.tsx file are functioning as expected, and there are no other issues in the codebase.

Testing / Review
Reviewers can verify the changes in this PR by:

  • Examining the new SideNavItems.tsx file and its associated TypeScript types for correctness and completeness.
  • Confirming that the issue related to the isSideNavExpanded prop has been successfully resolved.

@Nirajsah Nirajsah requested a review from a team as a code owner October 11, 2023 08:59
@Nirajsah Nirajsah changed the title feat(component): feat(component): Convert SideNavItems.js to SideNavItems.tsx Oct 11, 2023
@netlify
Copy link

netlify bot commented Oct 11, 2023

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 610ae12
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/652d3782bb11680008358f5d
😎 Deploy Preview https://deploy-preview-14861--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.

@netlify
Copy link

netlify bot commented Oct 11, 2023

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 610ae12
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/652d378217ada00009c78cd9
😎 Deploy Preview https://deploy-preview-14861--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 configuration.

@Nirajsah Nirajsah closed this Oct 16, 2023
@Nirajsah Nirajsah reopened this Oct 16, 2023
@Nirajsah Nirajsah closed this Oct 21, 2023
@Nirajsah Nirajsah deleted the SideNavItems branch October 21, 2023 05:04
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.

Add TypeScript types to SideNavItems
1 participant