-
-
Notifications
You must be signed in to change notification settings - Fork 223
Open
Labels
bugSomething isn't workingSomething isn't workinglimitationConstraints of the existing architecture make this hard to fixConstraints of the existing architecture make this hard to fix
Description
Describe the bug
There seems to be an issue with parsing object types for snippet parameters. This only happens when the <script> is below the snippet definition.
<!-- everything works when the script tag is at the top... -->
<!-- <script lang="ts"></script> -->
{#snippet foo(props: { props?: Record<string, unknown> })}{/snippet}
<!-- this won't error if you uncomment the snippet above -->
{#snippet bar(props: Record<string, unknown>)}{/snippet}
<!-- ...but not when it's at the bottom -->
<script lang="ts"></script>EDIT: seems to happen in other cases too, not just snippets.
<CalendarPrimitive.Day
bind:ref
class={cn(...)}
{...restProps}
/>
<script lang="ts">
import {Calendar as CalendarPrimitive} from 'bits-ui'
import {buttonVariants} from '$lib/components/ui/button/index.js'
import {cn} from '$lib/utils.js'
let {ref = $bindable(null), class: className, ...restProps}: CalendarPrimitive.DayProps = $props()
</script>Reproduction
https://github.com/abdel-17/snippet-ts-bug
Expected behaviour
It should not error
System Info
- OS: [e.g. Linux]
- IDE: [e.g. Neovim]
Which package is the issue about?
No response
Additional Information, eg. Screenshots

Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinglimitationConstraints of the existing architecture make this hard to fixConstraints of the existing architecture make this hard to fix