feat: Variadic snippets

elliott/add-variadic-snippets
S. Elliott Johnson 2 years ago
parent eab690d31a
commit ff2e84031e

@ -67,7 +67,7 @@ export type MessageEventHandler<T extends EventTarget> = EventHandler<MessageEve
export interface DOMAttributes<T extends EventTarget> { export interface DOMAttributes<T extends EventTarget> {
// Implicit children prop every element has // Implicit children prop every element has
// Add this here so that libraries doing `$props<HTMLButtonAttributes>()` don't need a separate interface // Add this here so that libraries doing `$props<HTMLButtonAttributes>()` don't need a separate interface
children?: import('svelte').Snippet<void>; children?: import('svelte').Snippet;
// Clipboard Events // Clipboard Events
'on:copy'?: ClipboardEventHandler<T> | undefined | null; 'on:copy'?: ClipboardEventHandler<T> | undefined | null;

@ -195,8 +195,8 @@ 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 extends unknown[] = []> {
(arg: T): typeof SnippetReturn & { (...args: T): typeof SnippetReturn & {
_: 'functions passed to {@render ...} tags must use the `Snippet` type imported from "svelte"'; _: 'functions passed to {@render ...} tags must use the `Snippet` type imported from "svelte"';
}; };
} }

Loading…
Cancel
Save