From 88f1a8f62e25a889c3985ae8e733801cc647ae4e Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Wed, 22 Nov 2023 23:43:17 +0100 Subject: [PATCH] chore: better error message for not using snippet type (#9602) language tools checks that a function passed to `{@render ..}` is returning a type that adheres to the `Snippet` return type. When it does not, the error message is pretty useless without this additional info text. --- packages/svelte/src/main/public.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/svelte/src/main/public.d.ts b/packages/svelte/src/main/public.d.ts index e98a627342..6851d3f1d7 100644 --- a/packages/svelte/src/main/public.d.ts +++ b/packages/svelte/src/main/public.d.ts @@ -195,7 +195,9 @@ declare const SnippetReturn: unique symbol; * You can only call a snippet through the `{@render ...}` tag. */ export interface Snippet { - (arg: T): typeof SnippetReturn; + (arg: T): typeof SnippetReturn & { + _: 'functions passed to {@render ...} tags must use the `Snippet` type imported from "svelte"'; + }; } interface DispatchOptions {