Skip to content

Commit 88f1a8f

Browse files
authored
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.
1 parent 5f6c5ca commit 88f1a8f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/svelte/src/main/public.d.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ declare const SnippetReturn: unique symbol;
195195
* You can only call a snippet through the `{@render ...}` tag.
196196
*/
197197
export interface Snippet<T = void> {
198-
(arg: T): typeof SnippetReturn;
198+
(arg: T): typeof SnippetReturn & {
199+
_: 'functions passed to {@render ...} tags must use the `Snippet` type imported from "svelte"';
200+
};
199201
}
200202

201203
interface DispatchOptions {

0 commit comments

Comments
 (0)