Skip to content

Commit df994c4

Browse files
committed
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.
1 parent 13c6c27 commit df994c4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ 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+
(
199+
arg: T
200+
): typeof SnippetReturn & {
201+
_: 'functions passed to {@render ...} tags must use the `Snippet` type imported from "svelte"';
202+
};
199203
}
200204

201205
interface DispatchOptions {

0 commit comments

Comments
 (0)