Skip to content

Commit

Permalink
Swap the order of the two derived store signatures to fix inference (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexGalays committed Jan 28, 2021
1 parent 37b1a20 commit 4d5fe5d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/runtime/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,12 @@ type StoresValues<T> = T extends Readable<infer U> ? U :
*
* @param stores - input stores
* @param fn - function callback that aggregates the values
* @param initial_value - when used asynchronously
*/
export function derived<S extends Stores, T>(
stores: S,
fn: (values: StoresValues<S>) => T
fn: (values: StoresValues<S>, set: (value: T) => void) => Unsubscriber | void,
initial_value?: T
): Readable<T>;

/**
Expand All @@ -137,12 +139,10 @@ export function derived<S extends Stores, T>(
*
* @param stores - input stores
* @param fn - function callback that aggregates the values
* @param initial_value - when used asynchronously
*/
export function derived<S extends Stores, T>(
stores: S,
fn: (values: StoresValues<S>, set: (value: T) => void) => Unsubscriber | void,
initial_value?: T
fn: (values: StoresValues<S>) => T
): Readable<T>;

export function derived<T>(stores: Stores, fn: Function, initial_value?: T): Readable<T> {
Expand Down

0 comments on commit 4d5fe5d

Please sign in to comment.