From 713b607ec65b529842a6abcc589589bade53d8f1 Mon Sep 17 00:00:00 2001 From: thebadking <53491595+thebadking@users.noreply.github.com> Date: Tue, 23 Jan 2024 19:03:13 +0200 Subject: [PATCH] TS definitions update TS definitions update due to build error with strict rules --- apps/www/registry/default/ui/switch.tsx | 55 ++++++++++++++----------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/apps/www/registry/default/ui/switch.tsx b/apps/www/registry/default/ui/switch.tsx index bc69cf2dbfc..e0de7d367c9 100644 --- a/apps/www/registry/default/ui/switch.tsx +++ b/apps/www/registry/default/ui/switch.tsx @@ -1,29 +1,38 @@ -"use client" +'use client'; -import * as React from "react" -import * as SwitchPrimitives from "@radix-ui/react-switch" +import * as React from 'react'; +import * as SwitchPrimitives from '@radix-ui/react-switch'; +import { cn } from '@/lib/utils'; -import { cn } from "@/lib/utils" +type SwitchProps = { + className?: string; + checked?: boolean; + onCheckedChange?: (checked: boolean) => void; + disabled?: boolean; +}; -const Switch = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - - (({ className, ...props }, ref) => { + const RootAsJSX = SwitchPrimitives.Root as React.ElementType; + const ThumbAsJSX = SwitchPrimitives.Thumb as React.ElementType; + + return ( + - -)) -Switch.displayName = SwitchPrimitives.Root.displayName + {...props} + ref={ref} + > + + + ); +}); + +Switch.displayName = 'Switch'; -export { Switch } +export { Switch };