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

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.
EDIT: seems to happen in other cases too, not just snippets.
Reproduction
https://github.com/abdel-17/snippet-ts-bug
Expected behaviour
It should not error
System Info
Which package is the issue about?
No response
Additional Information, eg. Screenshots