Skip to content

Commit b09af7c

Browse files
authored
Fix wrong typing of TabAction prop (#1497)
* fix(tab-action): use type case to correct wrong type infer * chore(changeset): add changeset to bump patch version
1 parent 88cb17d commit b09af7c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.changeset/cuddly-cows-hammer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@channel.io/bezier-react": patch
3+
---
4+
5+
add type cast to fix incorrect type infer in `TabAction` component

packages/bezier-react/src/components/Tabs/TabAction.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ const getIconSizeBy = (size: TabSize) => {
4242
* `TabAction` is a button for more action to open a new link or navigate to a different url.
4343
* If it has `href` props, it should act as a link.
4444
*/
45-
export const TabAction = forwardRef(function TabAction<Link extends string | undefined>({
45+
export const TabAction = forwardRef(function TabAction({
4646
href,
4747
children,
4848
onClick,
4949
...rest
50-
}: TabActionProps<Link>, forwardedRef: React.Ref<TabActionElement<Link>>,
50+
}, forwardedRef,
5151
) {
5252
const { size } = useTabListContext()
5353

@@ -88,4 +88,8 @@ export const TabAction = forwardRef(function TabAction<Link extends string | und
8888
</Styled.ToolbarLink>
8989
)
9090
)
91-
})
91+
}) as <Link extends string | undefined>(
92+
props: TabActionProps<Link> & {
93+
ref?: React.ForwardedRef<TabActionElement<Link>>
94+
}
95+
) => JSX.Element

0 commit comments

Comments
 (0)