From a7786aba7c14703914cef2dee828db334eb85c18 Mon Sep 17 00:00:00 2001 From: LexSwed Date: Sat, 31 Dec 2022 17:30:02 +0100 Subject: [PATCH] fix(ActionGroup): simplify types --- src/lib/action-group/action-group.tsx | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/lib/action-group/action-group.tsx b/src/lib/action-group/action-group.tsx index 1cd22aff..f4834ed2 100644 --- a/src/lib/action-group/action-group.tsx +++ b/src/lib/action-group/action-group.tsx @@ -2,28 +2,21 @@ import * as ToggleGroup from '@radix-ui/react-toggle-group'; import flattenChildren from 'react-keyed-flatten-children'; import { clsx } from 'clsx'; -import { ComponentProps, ForwardedRef, forwardRef, isValidElement, ReactElement, ReactNode } from 'react'; +import { ComponentProps, ForwardedRef, forwardRef, isValidElement, ReactElement } from 'react'; import { ToggleButton } from '../toggle-button'; import { flexCss, FlexVariants } from '../flex/flex'; import styles from './action-group.module.css'; -type Props = FlexVariants & - Omit< - T extends { type: 'single' } ? ToggleGroup.ToggleGroupSingleProps : ToggleGroup.ToggleGroupMultipleProps, - 'direction' | 'rovingFocus' | 'as' - > & { - children?: ReactNode; - }; +type Props = FlexVariants & + Omit; export const ActionGroup = forwardRef( - ( - { children, type, gap = 'none', value, className, ...props }: Props, - ref: ForwardedRef - ) => { + ({ children, type, gap = 'none', value, className, ...props }: Props, ref: ForwardedRef) => { return ( + // @ts-expect-error 🤷‍♂️