Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export declare class Store<S> {

export function createStore<S>(options: StoreOptions<S>): Store<S>;

export function useStore<S = any>(): Store<S>;

export interface Dispatch {
(type: string, payload?: any, options?: DispatchOptions): Promise<any>;
<P extends Payload>(payloadWithType: P, options?: DispatchOptions): Promise<any>;
Expand Down
12 changes: 12 additions & 0 deletions types/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ namespace StoreInstance {
store.replaceState({ value: 10 });
}

namespace UseStoreFunction {
interface State {
a: string
}

const storeWithState = Vuex.useStore<State>()
storeWithState.state.a

const storeAsAny = Vuex.useStore()
storeAsAny.state.a
}

namespace RootModule {
const store = new Vuex.Store({
state: {
Expand Down