huntabyte / vaul-svelte

An unstyled drawer component for Svelte.
https://vaul-svelte.com
MIT License
467 stars 19 forks source link

Children does not exist on Props #67

Closed wh1337 closed 8 months ago

wh1337 commented 8 months ago

Describe the bug

Using this with shadcn-svelte, however the prop children doesn't exist. 2024-03-13 at 11 01 34

The drawer still works, but building the app fails because of the type checking.

Reproduction

<script lang="ts>
...

import * as Drawer from '$lib/components/ui/drawer'
</script>

...
<Drawer.Root>
    <Drawer.Trigger>
        <Button>Click Me</Button>
    </Drawer.Trigger>
    <Drawer.Content>
        <Drawer.Header>
            <Drawer.Title>Are you sure absolutely sure?</Drawer.Title>
            <Drawer.Description>This action cannot be undone.</Drawer.Description>
        </Drawer.Header>
    </Drawer.Content>
</Drawer.Root>

drawer.svelte

<script lang="ts">
    import { Drawer as DrawerPrimitive } from 'vaul-svelte';

    type $$Props = DrawerPrimitive.Props;
    export let shouldScaleBackground: $$Props['shouldScaleBackground'] = true;
    export let open: $$Props['open'] = false;
    export let activeSnapPoint: $$Props['activeSnapPoint'] = undefined;
</script>

<DrawerPrimitive.Root {shouldScaleBackground} bind:open bind:activeSnapPoint {...$$restProps}>
    <slot />
</DrawerPrimitive.Root>

Logs

none

System Info

System:
    OS: macOS 14.4
    CPU: (12) arm64 Apple M2 Pro
    Memory: 123.91 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v20.10.0/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.11.0 - ~/.nvm/versions/node/v20.10.0/bin/pnpm
  Browsers:
    Chrome: 122.0.6261.112
    Edge: 122.0.2365.80
    Safari: 17.4

Severity

annoyance

huntabyte commented 8 months ago

What version of Svelte are you using? If you're using Svelte 5 we don't support it until it's stable.

wh1337 commented 8 months ago

What version of Svelte are you using? If you're using Svelte 5 we don't support it until it's stable.

That would be the reason. I am using Svelte 5, testing it out. Reverting back to Svelte 4.

...sometime later....

Just tested, works with no errors on Svelte 4, thanks again!