Skip to content

Commit

Permalink
fix: restore string (pathname) in union type for previous LocationDes…
Browse files Browse the repository at this point in the history
…criptor (#1791)

* fix: restore string (path) in union type for Location
  • Loading branch information
rezrah committed Jan 13, 2022
1 parent 2d5f64e commit 6a8472b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .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
4 changes: 2 additions & 2 deletions 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'
Expand Down Expand Up @@ -54,7 +54,7 @@ function Breadcrumbs({className, children, sx: sxProp}: React.PropsWithChildren<
}

type StyledBreadcrumbsItemProps = {
to?: Location
to?: Location | Pathname
selected?: boolean
} & SxProp

Expand Down
4 changes: 2 additions & 2 deletions src/Header.tsx
@@ -1,12 +1,12 @@
import {Location} from 'history'
import {Location, Pathname} from 'history'
import styled, {css} from 'styled-components'
import {get} from './constants'
import sx, {SxProp} from './sx'
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<StyledHeaderProps>`
z-index: 32;
Expand Down
4 changes: 2 additions & 2 deletions 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'
Expand Down Expand Up @@ -54,7 +54,7 @@ const SideNav = styled(SideNavBase)<SxProp>`
${sx};
`
type StyledSideNavLinkProps = {
to?: Location
to?: Location | Pathname
selected?: boolean
variant?: 'full' | 'normal'
}
Expand Down
4 changes: 2 additions & 2 deletions 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'
Expand Down Expand Up @@ -58,7 +58,7 @@ const SubNavLinks = styled.div<SubNavLinksProps>`
`

type StyledSubNavLinkProps = {
to?: Location
to?: Location | Pathname
selected?: boolean
} & SxProp

Expand Down
4 changes: 2 additions & 2 deletions 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'
Expand Down Expand Up @@ -32,7 +32,7 @@ function TabNav({children, 'aria-label': ariaLabel, ...rest}: TabNavProps) {
}

type StyledTabNavLinkProps = {
to?: Location
to?: Location | Pathname
selected?: boolean
} & SxProp

Expand Down
4 changes: 2 additions & 2 deletions 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'
Expand Down Expand Up @@ -59,7 +59,7 @@ function UnderlineNav({actions, className, align, children, full, label, theme,
}

type StyledUnderlineNavLinkProps = {
to?: Location
to?: Location | Pathname
selected?: boolean
} & SxProp

Expand Down

0 comments on commit 6a8472b

Please sign in to comment.