tweak types

pull/12425/head
Rich Harris 2 years ago
parent 263ef5f3a3
commit 5f77f80c6d

@ -1,4 +1,5 @@
/** @import { Effect, TemplateNode } from '#client' */
/** @import { Getters } from '#shared' */
import { add_snippet_symbol } from '../../../shared/validate.js';
import { EFFECT_TRANSPARENT } from '../../constants.js';
import { branch, block, destroy_effect } from '../../reactivity/effects.js';
@ -73,8 +74,8 @@ export function wrap_snippet(component, fn) {
* Create a snippet imperatively using mount, hyrdate and render functions.
* @template {unknown[]} Params
* @param {{
* mount: (...params: LazyParams<Params>) => Element,
* hydrate?: (element: Element, ...params: LazyParams<Params>) => void,
* mount: (...params: Getters<Params>) => Element,
* hydrate?: (element: Element, ...params: Getters<Params>) => void,
* render: (...params: Params) => string
* }} options
* @returns {import('svelte').Snippet<Params>}

@ -6,3 +6,7 @@ export type Store<V> = {
export type SourceLocation =
| [line: number, column: number]
| [line: number, column: number, SourceLocation[]];
export type Getters<T> = {
[K in keyof T]: () => T[K];
};

@ -1,4 +1,5 @@
/** @import { TemplateNode } from '#client' */
/** @import { Getters } from '#shared' */
import { is_void } from '../../constants.js';
import * as w from './warnings.js';
import * as e from './errors.js';
@ -6,7 +7,8 @@ import * as e from './errors.js';
const snippet_symbol = Symbol.for('svelte.snippet');
/**
* @param {(anchor: TemplateNode, ...args: any[]) => void} fn
* @template {unknown[]} Params
* @param {(anchor: TemplateNode, ...args: Getters<Params>) => void} fn
* @returns {import('svelte').Snippet}
*/
export function add_snippet_symbol(fn) {

Loading…
Cancel
Save