|
|
|
|
@ -101,6 +101,15 @@ declare module 'svelte' {
|
|
|
|
|
$set(props: Partial<Props>): void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const brand: unique symbol;
|
|
|
|
|
type Brand<B> = { [brand]: B };
|
|
|
|
|
type Branded<T, B> = T & Brand<B>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Internal implementation details that vary between environments
|
|
|
|
|
*/
|
|
|
|
|
export type ComponentInternals = Branded<{}, 'ComponentInternals'>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Can be used to create strongly typed Svelte components.
|
|
|
|
|
*
|
|
|
|
|
@ -133,7 +142,8 @@ declare module 'svelte' {
|
|
|
|
|
* @param props The props passed to the component.
|
|
|
|
|
*/
|
|
|
|
|
(
|
|
|
|
|
internal: unknown,
|
|
|
|
|
this: void,
|
|
|
|
|
internals: ComponentInternals,
|
|
|
|
|
props: Props
|
|
|
|
|
): {
|
|
|
|
|
/**
|
|
|
|
|
@ -251,7 +261,10 @@ declare module 'svelte' {
|
|
|
|
|
element?: typeof HTMLElement;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const SnippetReturn: unique symbol;
|
|
|
|
|
/**
|
|
|
|
|
* Internal implementation details that vary between environments
|
|
|
|
|
*/
|
|
|
|
|
export type SnippetInternals = Branded<{}, 'SnippetInternals'>;
|
|
|
|
|
|
|
|
|
|
// Use an interface instead of a type, makes for better intellisense info because the type is named in more situations.
|
|
|
|
|
/**
|
|
|
|
|
@ -268,13 +281,12 @@ declare module 'svelte' {
|
|
|
|
|
export interface Snippet<Parameters extends unknown[] = []> {
|
|
|
|
|
(
|
|
|
|
|
this: void,
|
|
|
|
|
internal: SnippetInternals,
|
|
|
|
|
// this conditional allows tuples but not arrays. Arrays would indicate a
|
|
|
|
|
// rest parameter type, which is not supported. If rest parameters are added
|
|
|
|
|
// in the future, the condition can be removed.
|
|
|
|
|
...args: number extends Parameters['length'] ? never : Parameters
|
|
|
|
|
): typeof SnippetReturn & {
|
|
|
|
|
_: 'functions passed to {@render ...} tags must use the `Snippet` type imported from "svelte"';
|
|
|
|
|
};
|
|
|
|
|
...args: number extends Parameters['length'] ? never : Getters<Parameters>
|
|
|
|
|
): void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface DispatchOptions {
|
|
|
|
|
@ -293,6 +305,9 @@ declare module 'svelte' {
|
|
|
|
|
: [type: Type, parameter: EventMap[Type], options?: DispatchOptions]
|
|
|
|
|
): boolean;
|
|
|
|
|
}
|
|
|
|
|
type Getters<T> = {
|
|
|
|
|
[K in keyof T]: () => T[K];
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
* The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.
|
|
|
|
|
* It must be called during the component's initialisation (but doesn't need to live *inside* the component;
|
|
|
|
|
@ -457,9 +472,6 @@ declare module 'svelte' {
|
|
|
|
|
* https://svelte.dev/docs/svelte#getallcontexts
|
|
|
|
|
* */
|
|
|
|
|
export function getAllContexts<T extends Map<any, any> = Map<any, any>>(): T;
|
|
|
|
|
type Getters<T> = {
|
|
|
|
|
[K in keyof T]: () => T[K];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export {};
|
|
|
|
|
}
|
|
|
|
|
|