diff --git a/.changeset/gorgeous-jeans-occur.md b/.changeset/gorgeous-jeans-occur.md new file mode 100644 index 00000000000..1b726f689b2 --- /dev/null +++ b/.changeset/gorgeous-jeans-occur.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +replace `Location | Pathname` union type for `to` prop with more appropriate `To` diff --git a/src/Breadcrumbs.tsx b/src/Breadcrumbs.tsx index dc195754857..c31308e04f3 100644 --- a/src/Breadcrumbs.tsx +++ b/src/Breadcrumbs.tsx @@ -1,5 +1,5 @@ import classnames from 'classnames' -import {Location, Pathname} from 'history' +import {To} from 'history' import React from 'react' import styled from 'styled-components' import Box from './Box' @@ -54,7 +54,7 @@ function Breadcrumbs({className, children, sx: sxProp}: React.PropsWithChildren< } type StyledBreadcrumbsItemProps = { - to?: Location | Pathname + to?: To selected?: boolean } & SxProp diff --git a/src/SideNav.tsx b/src/SideNav.tsx index a9b1bfde5d1..3b4cc0bd768 100644 --- a/src/SideNav.tsx +++ b/src/SideNav.tsx @@ -1,4 +1,4 @@ -import {Location, Pathname} from 'history' +import {To} from 'history' import {get} from './constants' import styled, {css} from 'styled-components' @@ -54,7 +54,7 @@ const SideNav = styled(SideNavBase)` ${sx}; ` type StyledSideNavLinkProps = { - to?: Location | Pathname + to?: To selected?: boolean variant?: 'full' | 'normal' } diff --git a/src/SubNav.tsx b/src/SubNav.tsx index 80e8e0a25cb..72d31ed7c28 100644 --- a/src/SubNav.tsx +++ b/src/SubNav.tsx @@ -1,5 +1,5 @@ import classnames from 'classnames' -import {Location, Pathname} from 'history' +import {To} from 'history' import React from 'react' import styled from 'styled-components' import {get} from './constants' @@ -58,7 +58,7 @@ const SubNavLinks = styled.div` ` type StyledSubNavLinkProps = { - to?: Location | Pathname + to?: To selected?: boolean } & SxProp diff --git a/src/TabNav.tsx b/src/TabNav.tsx index 6d408618a72..c4204d406f9 100644 --- a/src/TabNav.tsx +++ b/src/TabNav.tsx @@ -1,5 +1,5 @@ import classnames from 'classnames' -import {Location, Pathname} from 'history' +import {To} from 'history' import React from 'react' import styled from 'styled-components' import {get} from './constants' @@ -32,7 +32,7 @@ function TabNav({children, 'aria-label': ariaLabel, ...rest}: TabNavProps) { } type StyledTabNavLinkProps = { - to?: Location | Pathname + to?: To selected?: boolean } & SxProp diff --git a/src/UnderlineNav.tsx b/src/UnderlineNav.tsx index 79eaf704e6b..5a698027f1e 100644 --- a/src/UnderlineNav.tsx +++ b/src/UnderlineNav.tsx @@ -1,5 +1,5 @@ import classnames from 'classnames' -import {Location, Pathname} from 'history' +import {To} from 'history' import React from 'react' import styled from 'styled-components' import {get} from './constants' @@ -59,7 +59,7 @@ function UnderlineNav({actions, className, align, children, full, label, theme, } type StyledUnderlineNavLinkProps = { - to?: Location | Pathname + to?: To selected?: boolean } & SxProp