Skip to content

Commit d50789e

Browse files
Not-Jaydendummdidumm
authored andcommitted
fix: Update $derived.call type declaration (#10349)
--------- Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
1 parent ae93e05 commit d50789e

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.changeset/honest-dragons-turn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
Use generic `T` as the return type for `$derived.call()`

packages/svelte/src/main/ambient.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ declare namespace $derived {
7777
*
7878
* https://svelte-5-preview.vercel.app/docs/runes#$derived-call
7979
*/
80-
export function call<T>(fn: () => T): void;
80+
export function call<T>(fn: () => T): T;
8181
}
8282

8383
/**

packages/svelte/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2511,7 +2511,7 @@ declare namespace $derived {
25112511
*
25122512
* https://svelte-5-preview.vercel.app/docs/runes#$derived-call
25132513
*/
2514-
export function call<T>(fn: () => T): void;
2514+
export function call<T>(fn: () => T): T;
25152515
}
25162516

25172517
/**

0 commit comments

Comments
 (0)