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.
pull/9576/head
Simon H 1 year ago committed by GitHub
parent 5f6c5ca8ae
commit 88f1a8f62e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -195,7 +195,9 @@ declare const SnippetReturn: unique symbol;
* You can only call a snippet through the `{@render ...}` tag. * You can only call a snippet through the `{@render ...}` tag.
*/ */
export interface Snippet<T = void> { 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 { interface DispatchOptions {

Loading…
Cancel
Save