Skip to content

Commit

Permalink
Fix wrong typing of TabAction prop (#1497)
Browse files Browse the repository at this point in the history
* fix(tab-action): use type case to correct wrong type infer

* chore(changeset): add changeset to bump patch version
  • Loading branch information
yangwooseong authored Jul 18, 2023
1 parent 88cb17d commit b09af7c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/cuddly-cows-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@channel.io/bezier-react": patch
---

add type cast to fix incorrect type infer in `TabAction` component
10 changes: 7 additions & 3 deletions packages/bezier-react/src/components/Tabs/TabAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ const getIconSizeBy = (size: TabSize) => {
* `TabAction` is a button for more action to open a new link or navigate to a different url.
* If it has `href` props, it should act as a link.
*/
export const TabAction = forwardRef(function TabAction<Link extends string | undefined>({
export const TabAction = forwardRef(function TabAction({
href,
children,
onClick,
...rest
}: TabActionProps<Link>, forwardedRef: React.Ref<TabActionElement<Link>>,
}, forwardedRef,
) {
const { size } = useTabListContext()

Expand Down Expand Up @@ -88,4 +88,8 @@ export const TabAction = forwardRef(function TabAction<Link extends string | und
</Styled.ToolbarLink>
)
)
})
}) as <Link extends string | undefined>(
props: TabActionProps<Link> & {
ref?: React.ForwardedRef<TabActionElement<Link>>
}
) => JSX.Element

0 comments on commit b09af7c

Please sign in to comment.