Skip to content

Commit 0578bcb

Browse files
committed
remove ts-ignore
1 parent 8850160 commit 0578bcb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/styled-react/src/components/TabNav.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ const StyledTabNav = styled(PrimerTabNav).withConfig({
1313
${sx}
1414
`
1515

16-
// @ts-ignore forwardedAs is valid here but I don't know how to fix the typescript error
17-
const TabNavImpl = ({as, ...props}: TabNavProps) => <StyledTabNav forwardedAs={as} {...props} />
16+
const TabNavImpl = ({as, ...props}: TabNavProps) => {
17+
return <StyledTabNav {...props} {...(as ? {forwardedAs: as as React.ElementType} : {})} />
18+
}
1819

1920
const StyledTabNavLink: ForwardRefComponent<'a', TabNavLinkProps> = styled(PrimerTabNav.Link).withConfig({
2021
shouldForwardProp: prop => (prop as keyof TabNavLinkProps) !== 'sx',
2122
})<TabNavLinkProps>`
2223
${sx}
2324
`
2425

25-
// @ts-ignore forwardedAs is valid here but I don't know how to fix the typescript error
26-
const TabNavLink = ({as, ...props}: TabNavLinkProps) => <StyledTabNavLink forwardedAs={as} {...props} />
26+
const TabNavLink = ({as, ...props}: TabNavLinkProps) => (
27+
<StyledTabNavLink {...props} {...(as ? {forwardedAs: as} : {})} />
28+
)
2729

2830
const TabNav = Object.assign(TabNavImpl, {
2931
Link: TabNavLink,

0 commit comments

Comments
 (0)