Skip to content

Commit

Permalink
chore: better error message for not using snippet type (#9602)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dummdidumm authored Nov 22, 2023
1 parent 5f6c5ca commit 88f1a8f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/svelte/src/main/public.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ declare const SnippetReturn: unique symbol;
* You can only call a snippet through the `{@render ...}` tag.
*/
export interface Snippet<T = void> {
(arg: T): typeof SnippetReturn;
(arg: T): typeof SnippetReturn & {
_: 'functions passed to {@render ...} tags must use the `Snippet` type imported from "svelte"';
};
}

interface DispatchOptions {
Expand Down

0 comments on commit 88f1a8f

Please sign in to comment.