diff --git a/.changeset/unlucky-jobs-tickle.md b/.changeset/unlucky-jobs-tickle.md new file mode 100644 index 00000000000..747195ab053 --- /dev/null +++ b/.changeset/unlucky-jobs-tickle.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +Fix type errors due to missing pathname (string) in union type for LocationDescriptor diff --git a/src/Breadcrumbs.tsx b/src/Breadcrumbs.tsx index 6b107de5bc4..dc195754857 100644 --- a/src/Breadcrumbs.tsx +++ b/src/Breadcrumbs.tsx @@ -1,5 +1,5 @@ import classnames from 'classnames' -import {Location} from 'history' +import {Location, Pathname} 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 + to?: Location | Pathname selected?: boolean } & SxProp diff --git a/src/Header.tsx b/src/Header.tsx index 96a4fc860c6..895e9f11cdd 100644 --- a/src/Header.tsx +++ b/src/Header.tsx @@ -1,4 +1,4 @@ -import {Location} from 'history' +import {Location, Pathname} from 'history' import styled, {css} from 'styled-components' import {get} from './constants' import sx, {SxProp} from './sx' @@ -6,7 +6,7 @@ import {ComponentProps} from './utils/types' type StyledHeaderItemProps = {full?: boolean} & SxProp type StyledHeaderProps = SxProp -type StyledHeaderLinkProps = {to?: Location} & SxProp +type StyledHeaderLinkProps = {to?: Location | Pathname} & SxProp const Header = styled.div` z-index: 32; diff --git a/src/SideNav.tsx b/src/SideNav.tsx index 7c389c0c432..a9b1bfde5d1 100644 --- a/src/SideNav.tsx +++ b/src/SideNav.tsx @@ -1,4 +1,4 @@ -import {Location} from 'history' +import {Location, Pathname} 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 + to?: Location | Pathname selected?: boolean variant?: 'full' | 'normal' } diff --git a/src/SubNav.tsx b/src/SubNav.tsx index 719f2e8e373..80e8e0a25cb 100644 --- a/src/SubNav.tsx +++ b/src/SubNav.tsx @@ -1,5 +1,5 @@ import classnames from 'classnames' -import {Location} from 'history' +import {Location, Pathname} 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 + to?: Location | Pathname selected?: boolean } & SxProp diff --git a/src/TabNav.tsx b/src/TabNav.tsx index 03935083498..6d408618a72 100644 --- a/src/TabNav.tsx +++ b/src/TabNav.tsx @@ -1,5 +1,5 @@ import classnames from 'classnames' -import {Location} from 'history' +import {Location, Pathname} 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 + to?: Location | Pathname selected?: boolean } & SxProp diff --git a/src/UnderlineNav.tsx b/src/UnderlineNav.tsx index b51123c0700..79eaf704e6b 100644 --- a/src/UnderlineNav.tsx +++ b/src/UnderlineNav.tsx @@ -1,5 +1,5 @@ import classnames from 'classnames' -import {Location} from 'history' +import {Location, Pathname} 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 + to?: Location | Pathname selected?: boolean } & SxProp