-
Notifications
You must be signed in to change notification settings - Fork 646
Fixing some Tab/UnderlineNav Link types. #533
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
Fixing some Tab/UnderlineNav Link types. #533
Conversation
|
This pull request is automatically deployed with Now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome 💯 Thanks for updating this! Just left one comment about href.
index.d.ts
Outdated
|
|
||
| export interface UnderlineNavItemProps extends CommonProps { | ||
| export interface UnderlineNavLinkProps extends CommonProps { | ||
| href: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| href: string | |
| href?: string |
Should href be optional?
Reach Router's Link component accepts a to prop instead of href. If someone does something like this:
<UnderlineNav.Link as={ReachLink} to="#" />
will it cause a TypeError?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I think it will. I was going for consistency with LinkProps where it is also required.
export interface LinkProps extends CommonProps, TypographyProps {
href: string
underline?: boolean
}
Do we want that to be optional as well, in case someone wanted to do:
<Link as={ReachLink} to="#" />
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's a good idea.
colebemis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! 👍 I wanna let @emplums take a look at this too before we merge it. She'll be back next week.
|
This looks good to me, thanks @dmarcey! |
I tried out the
UnderlineNavandTabNavin a TypeScript app (create-react-app --typescript) and ran into some issues related to the types of the Links.This PR cleans them up, as well as the
propTypeson theUnderlineNav.LinkandTabNav.LinkMerge checklist
index.d.ts) if necessary