types + changeset

effect-abort
Dominic Gannaway 1 week ago
parent df4885e62e
commit 085301728b

@ -0,0 +1,5 @@
---
'svelte': minor
---
feat: pass AbortSignal to effects and allow async signature

@ -234,7 +234,9 @@ declare namespace $derived {
* https://svelte.dev/docs/svelte/$effect * https://svelte.dev/docs/svelte/$effect
* @param fn The function to execute * @param fn The function to execute
*/ */
declare function $effect(fn: (input: { signal: AbortSignal }) => void | ((input: { signal: AbortSignal }) => void)): void; declare function $effect(
fn: (input: { signal: AbortSignal }) => void | (() => void) | Promise<void>
): void;
declare namespace $effect { declare namespace $effect {
/** /**
@ -253,7 +255,9 @@ declare namespace $effect {
* https://svelte.dev/docs/svelte/$effect#$effect.pre * https://svelte.dev/docs/svelte/$effect#$effect.pre
* @param fn The function to execute * @param fn The function to execute
*/ */
export function pre(fn: (input: { signal: AbortSignal }) => void | ((input: { signal: AbortSignal }) => void)): void; export function pre(
fn: (input: { signal: AbortSignal }) => void | (() => void) | Promise<void>
): void;
/** /**
* The `$effect.tracking` rune is an advanced feature that tells you whether or not the code is running inside a tracking context, such as an effect or inside your template. * The `$effect.tracking` rune is an advanced feature that tells you whether or not the code is running inside a tracking context, such as an effect or inside your template.

@ -2892,7 +2892,9 @@ declare namespace $derived {
* https://svelte.dev/docs/svelte/$effect * https://svelte.dev/docs/svelte/$effect
* @param fn The function to execute * @param fn The function to execute
*/ */
declare function $effect(fn: (input: { signal: AbortSignal }) => void | ((input: { signal: AbortSignal }) => void)): void; declare function $effect(
fn: (input: { signal: AbortSignal }) => void | (() => void) | Promise<void>
): void;
declare namespace $effect { declare namespace $effect {
/** /**
@ -2911,7 +2913,9 @@ declare namespace $effect {
* https://svelte.dev/docs/svelte/$effect#$effect.pre * https://svelte.dev/docs/svelte/$effect#$effect.pre
* @param fn The function to execute * @param fn The function to execute
*/ */
export function pre(fn: (input: { signal: AbortSignal }) => void | ((input: { signal: AbortSignal }) => void)): void; export function pre(
fn: (input: { signal: AbortSignal }) => void | (() => void) | Promise<void>
): void;
/** /**
* The `$effect.tracking` rune is an advanced feature that tells you whether or not the code is running inside a tracking context, such as an effect or inside your template. * The `$effect.tracking` rune is an advanced feature that tells you whether or not the code is running inside a tracking context, such as an effect or inside your template.

Loading…
Cancel
Save