Add missing types to store.d.ts

pull/1818/head
mrkishi 6 years ago
parent cd0a0a554f
commit b2718cedb9

14
store.d.ts vendored

@ -6,14 +6,24 @@ interface Cancellable {
cancel: () => void; cancel: () => void;
} }
interface Tuple<T extends any, L extends number> extends Array<T> {
0: T;
length: L;
}
type State = Record<string, any>; type State = Record<string, any>;
export declare class Store { export declare class Store {
constructor(state: State, options?: Options); constructor(state: State, options?: Options);
public compute(key: string, dependencies: string[]): void; public compute<L extends number>(
key: string,
dependencies: Tuple<string, L>,
fn: (...dependencies: Tuple<any, L>) => any,
): void;
public fire(name: string, data?: any): void; public fire(name: string, data?: any): void;
public get(): State; public get(): State;
public on(name: string, callback: (data: any) => void): Cancellable; public on(name: string, callback: (data: any) => void): Cancellable;
public set(state: State); public set(state: State): void;
} }

Loading…
Cancel
Save