fix: exclude multiple children without generic in DialogTrigger

This commit is contained in:
p-sw 2024-05-24 20:55:01 +09:00
parent 09bdb41160
commit 4c63b6bd9d

View File

@ -56,13 +56,11 @@ const DialogRoot = ({ children }: DialogRootProps) => {
* ========================= * =========================
*/ */
interface DialogTriggerProps<T extends React.ReactNode> { interface DialogTriggerProps {
children: T extends any[] ? never : T; children: Exclude<React.ReactNode, Iterable<React.ReactNode>>;
} }
const DialogTrigger = <T extends React.ReactNode>({ const DialogTrigger = ({ children }: DialogTriggerProps) => {
children,
}: DialogTriggerProps<T>) => {
const [_, setState] = useDialogContext(); const [_, setState] = useDialogContext();
// const onClick = () => setState((p) => ({ ...p, opened: true })); // const onClick = () => setState((p) => ({ ...p, opened: true }));