Skip to content

Commit 88e247a

Browse files
committed
[shadcn] Fix typescript errors
1 parent c80ec86 commit 88e247a

File tree

9 files changed

+28
-21
lines changed

9 files changed

+28
-21
lines changed

packages/shadcn-theme/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"@types/eslint": "catalog:",
7878
"ajv": "catalog:",
7979
"autoprefixer": "catalog:",
80-
"bits-ui": "1.0.0-next.30",
80+
"bits-ui": "1.0.0-next.31",
8181
"clsx": "^2.1.1",
8282
"eslint": "catalog:",
8383
"eslint-config-prettier": "catalog:",

packages/shadcn-theme/src/lib/default-ui/calendar/calendar-next-button.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import type { Snippet } from 'svelte';
23
import { Calendar as CalendarPrimitive } from "bits-ui";
34
import ChevronRight from "lucide-svelte/icons/chevron-right";
45
import { buttonVariants } from "$lib/default-ui/button/index.js";
@@ -23,6 +24,6 @@
2324
"size-7 bg-transparent p-0 opacity-50 hover:opacity-100",
2425
className
2526
)}
26-
children={children || Fallback}
27+
children={children as Snippet || Fallback}
2728
{...restProps}
2829
/>

packages/shadcn-theme/src/lib/default-ui/calendar/calendar-prev-button.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import type { Snippet } from 'svelte';
23
import { Calendar as CalendarPrimitive } from "bits-ui";
34
import ChevronLeft from "lucide-svelte/icons/chevron-left";
45
import { buttonVariants } from "$lib/default-ui/button/index.js";
@@ -23,6 +24,6 @@
2324
"size-7 bg-transparent p-0 opacity-50 hover:opacity-100",
2425
className
2526
)}
26-
children={children || Fallback}
27+
children={children as Snippet || Fallback}
2728
{...restProps}
2829
/>

packages/shadcn-theme/src/lib/default-ui/slider/slider.svelte

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<script lang="ts">
2-
import { Slider as SliderPrimitive, type WithoutChildrenOrChild } from "bits-ui";
3-
import { cn } from "$lib/utils.js";
2+
import {
3+
Slider as SliderPrimitive,
4+
type SliderRootSnippetProps,
5+
type WithoutChildrenOrChild
6+
} from 'bits-ui';
7+
import { cn } from '$lib/utils.js';
48
59
let {
610
ref = $bindable(null),
@@ -13,10 +17,10 @@
1317
<SliderPrimitive.Root
1418
bind:ref
1519
bind:value
16-
class={cn("relative flex w-full touch-none select-none items-center", className)}
20+
class={cn('relative flex w-full touch-none select-none items-center', className)}
1721
{...restProps}
1822
>
19-
{#snippet children({ thumbs })}
23+
{#snippet children({ thumbs }: SliderRootSnippetProps)}
2024
<span class="bg-secondary relative h-2 w-full grow overflow-hidden rounded-full">
2125
<SliderPrimitive.Range class="bg-primary absolute h-full" />
2226
</span>

packages/shadcn-theme/src/lib/new-york-ui/calendar/calendar-next-button.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import type { Snippet } from 'svelte';
23
import { Calendar as CalendarPrimitive } from "bits-ui";
34
import ChevronRight from "svelte-radix/ChevronRight.svelte";
45
import { buttonVariants } from "$lib/new-york-ui/button/index.js";
@@ -24,5 +25,5 @@
2425
className
2526
)}
2627
{...restProps}
27-
children={children || Fallback}
28+
children={children as Snippet || Fallback}
2829
/>

packages/shadcn-theme/src/lib/new-york-ui/calendar/calendar-prev-button.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import type { Snippet } from 'svelte';
23
import { Calendar as CalendarPrimitive } from "bits-ui";
34
import ChevronLeft from "svelte-radix/ChevronLeft.svelte";
45
import { buttonVariants } from "$lib/new-york-ui/button/index.js";
@@ -24,5 +25,5 @@
2425
className
2526
)}
2627
{...restProps}
27-
children={children || Fallback}
28+
children={children as Snippet || Fallback}
2829
/>

packages/shadcn-theme/src/lib/new-york-ui/slider/slider.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { Slider as SliderPrimitive, type WithoutChildrenOrChild } from "bits-ui";
2+
import { Slider as SliderPrimitive, type SliderRootSnippetProps, type WithoutChildrenOrChild } from "bits-ui";
33
import { cn } from "$lib/utils.js";
44
55
let {
@@ -18,7 +18,7 @@
1818
class={cn("relative flex w-full touch-none select-none items-center", className)}
1919
{...restProps}
2020
>
21-
{#snippet children({ thumbs })}
21+
{#snippet children({ thumbs }: SliderRootSnippetProps)}
2222
<span class="bg-primary/20 relative h-1.5 w-full grow overflow-hidden rounded-full">
2323
<SliderPrimitive.Range class="bg-primary absolute h-full" />
2424
</span>

packages/shadcn-theme/src/lib/theme/context.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ import type {
1919
WithoutChildrenOrChild
2020
} from 'bits-ui';
2121

22+
type CalendarProps = WithoutChildrenOrChild<Calendar.RootProps>;
23+
2224
export interface ThemeComponents {
2325
Button: Component<HTMLButtonAttributes>;
24-
Calendar: Component<
25-
WithoutChildrenOrChild<Calendar.RootProps>,
26-
{},
27-
'value' | 'placeholder' | 'ref'
28-
>;
26+
// @ts-expect-error too complex
27+
Calendar: Component<CalendarProps, {}, 'value' | 'placeholder' | 'ref'>;
2928
Checkbox: Component<WithoutChildrenOrChild<Checkbox.RootProps>, {}, 'checked' | 'ref'>;
3029
Input: Component<WithElementRef<HTMLInputAttributes>, {}, 'value' | 'ref'>;
3130
FilesInput: Component<

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)