feat: Variadic snippets

elliott/add-variadic-snippets
S. Elliott Johnson 10 months ago
parent eab690d31a
commit ff2e84031e

@ -67,7 +67,7 @@ export type MessageEventHandler<T extends EventTarget> = EventHandler<MessageEve
export interface DOMAttributes<T extends EventTarget> {
// Implicit children prop every element has
// 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
'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.
*/
export interface Snippet<T = void> {
(arg: T): typeof SnippetReturn & {
export interface Snippet<T extends unknown[] = []> {
(...args: T): typeof SnippetReturn & {
_: 'functions passed to {@render ...} tags must use the `Snippet` type imported from "svelte"';
};
}

Loading…
Cancel
Save