File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
packages/styled-react/src/components Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff 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
1920const 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
2830const TabNav = Object . assign ( TabNavImpl , {
2931 Link : TabNavLink ,
You can’t perform that action at this time.
0 commit comments