Skip to content

Commit 0e0bdd8

Browse files
authored
Add generic type to allow typing getters
Added a new generic type to allowing typing the getters
1 parent 7b024d8 commit 0e0bdd8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

types/index.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import { createLogger } from "./logger";
99
export * from "./helpers";
1010
export * from "./logger";
1111

12-
export declare class Store<S> {
12+
export declare class Store<S, G = any> {
1313
constructor(options: StoreOptions<S>);
1414

1515
readonly state: S;
16-
readonly getters: any;
16+
readonly getters: G;
1717

1818
install(app: App, injectKey?: InjectionKey<Store<any>> | string): void;
1919

@@ -24,7 +24,7 @@ export declare class Store<S> {
2424

2525
subscribe<P extends MutationPayload>(fn: (mutation: P, state: S) => any, options?: SubscribeOptions): () => void;
2626
subscribeAction<P extends ActionPayload>(fn: SubscribeActionOptions<P, S>, options?: SubscribeOptions): () => void;
27-
watch<T>(getter: (state: S, getters: any) => T, cb: (value: T, oldValue: T) => void, options?: WatchOptions): () => void;
27+
watch<T>(getter: (state: S, getters: G) => T, cb: (value: T, oldValue: T) => void, options?: WatchOptions): () => void;
2828

2929
registerModule<T>(path: string, module: Module<T, S>, options?: ModuleOptions): void;
3030
registerModule<T>(path: string[], module: Module<T, S>, options?: ModuleOptions): void;

0 commit comments

Comments
 (0)