From df994c40902976c797a04483845ad4095584dfa8 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Wed, 22 Nov 2023 23:28:54 +0100 Subject: [PATCH] chore: better error message for not using snippet type 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/svelte/src/main/public.d.ts b/packages/svelte/src/main/public.d.ts index e98a627342..d799204088 100644 --- a/packages/svelte/src/main/public.d.ts +++ b/packages/svelte/src/main/public.d.ts @@ -195,7 +195,11 @@ 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 {