children prop typed as unknownWhen a component destructures children from $props() without an explicit type annotation and renders it via {@render children?.()}, svelte-check-rs types children as unknown instead of Snippet. This causes a false type error:
src/lib/Wrapper.svelte:5:12
Error: This expression is not callable. (ts(TS2349))
Native svelte-check correctly infers children as Snippet.
<!-- src/lib/Wrapper.svelte -->
<script lang="ts">
let { children } = $props();
</script>
<div class="wrapper">
{@render children?.()} <!-- TS2349: not callable -->
</div>
--emit-ts)let { children } = ({} as __SvelteLoosen<Record<string, unknown>>);
// children: unknown
children?.(); // Error: unknown has no call signatures
The correct output should type children as Snippet based on the template usage.
pnpm install
npx svelte-check-rs
Add an explicit type annotation:
<script lang="ts">
import type { Snippet } from "svelte";
let { children }: { children: Snippet } = $props();
</script>