Skip to content

chore(types): improve Link types #8081

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

chore(types): improve Link types #8081

wants to merge 1 commit into from

Conversation

avivkeller
Copy link
Member

This PR expands the typings of #site/components/Link to allow for additional properties, like locale.

@Copilot Copilot AI review requested due to automatic review settings August 16, 2025 15:41
@avivkeller avivkeller requested a review from a team as a code owner August 16, 2025 15:41
Copy link

vercel bot commented Aug 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nodejs-org Ready Ready Preview Aug 16, 2025 3:41pm

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the type definitions for the Link component by creating a union type that supports both localized links and standard anchor elements, allowing for additional properties like locale. The changes simplify the Link component implementation while maintaining backward compatibility.

Key changes:

  • Refactored Link component to use a union type (LinkProps) that combines ComponentProps<typeof LocalizedLink> and AnchorHTMLAttributes<HTMLAnchorElement>
  • Simplified component implementations that use the Link component by removing redundant type definitions
  • Removed unnecessary kind="neutral" props from Link usage in MinorReleasesTable

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
apps/site/components/Link.tsx Refactored to use union type for props and simplified component logic
apps/site/components/LinkWithArrow.tsx Updated to use the new LinkProps type and added type assertion for Slot props
apps/site/components/Common/Button.tsx Simplified type definition by removing redundant prop omissions
apps/site/components/Releases/MinorReleasesTable/index.tsx Removed kind="neutral" props from Link components

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

@kylemocode kylemocode left a comment

Choose a reason for hiding this comment

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

LGTM, I will do the change in my PR once this got merged

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

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

LGMT !

@kylemocode
Copy link

@avivkeller Could you help to merge this one ? And I thought I can do the change immediately

@avivkeller avivkeller added github_actions:pull-request Trigger Pull Request Checks fast-track Fast Tracking PRs labels Aug 17, 2025
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Aug 17, 2025
@avivkeller avivkeller added the github_actions:pull-request Trigger Pull Request Checks label Aug 17, 2025
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Aug 17, 2025
@avivkeller
Copy link
Member Author

@nodejs/nodejs-website requesting fast track

Copy link
Contributor

github-actions bot commented Aug 17, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 99 🟢 100 🟢 100 🟢 100 🔗
/en/about 🟢 100 🟢 97 🟢 100 🟠 88 🔗
/en/about/previous-releases 🟢 99 🟢 93 🟢 100 🟠 89 🔗
/en/download 🟢 96 🟢 100 🟢 100 🟢 100 🔗
/en/blog 🟢 99 🟢 100 🟢 96 🟢 100 🔗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fast-track Fast Tracking PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants