From 4d5fe5dea6ab3264ed5d49b5baccd13b8fe38ca0 Mon Sep 17 00:00:00 2001 From: Alexandre Galays Date: Thu, 28 Jan 2021 12:56:40 +0100 Subject: [PATCH] Swap the order of the two derived store signatures to fix inference (#5935) --- src/runtime/store/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runtime/store/index.ts b/src/runtime/store/index.ts index 09040487f0..c8e2b4ff99 100644 --- a/src/runtime/store/index.ts +++ b/src/runtime/store/index.ts @@ -125,10 +125,12 @@ type StoresValues = T extends Readable ? U : * * @param stores - input stores * @param fn - function callback that aggregates the values + * @param initial_value - when used asynchronously */ export function derived( stores: S, - fn: (values: StoresValues) => T + fn: (values: StoresValues, set: (value: T) => void) => Unsubscriber | void, + initial_value?: T ): Readable; /** @@ -137,12 +139,10 @@ export function derived( * * @param stores - input stores * @param fn - function callback that aggregates the values - * @param initial_value - when used asynchronously */ export function derived( stores: S, - fn: (values: StoresValues, set: (value: T) => void) => Unsubscriber | void, - initial_value?: T + fn: (values: StoresValues) => T ): Readable; export function derived(stores: Stores, fn: Function, initial_value?: T): Readable {