File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ export declare class Store<S> {
43
43
44
44
export function createStore < S > ( options : StoreOptions < S > ) : Store < S > ;
45
45
46
+ export function useStore < S = any > ( ) : Store < S > ;
47
+
46
48
export interface Dispatch {
47
49
( type : string , payload ?: any , options ?: DispatchOptions ) : Promise < any > ;
48
50
< P extends Payload > ( payloadWithType : P , options ?: DispatchOptions ) : Promise < any > ;
Original file line number Diff line number Diff line change @@ -78,6 +78,18 @@ namespace StoreInstance {
78
78
store . replaceState ( { value : 10 } ) ;
79
79
}
80
80
81
+ namespace UseStoreFunction {
82
+ interface State {
83
+ a : string
84
+ }
85
+
86
+ const storeWithState = Vuex . useStore < State > ( )
87
+ storeWithState . state . a
88
+
89
+ const storeAsAny = Vuex . useStore ( )
90
+ storeAsAny . state . a
91
+ }
92
+
81
93
namespace RootModule {
82
94
const store = new Vuex . Store ( {
83
95
state : {
You can’t perform that action at this time.
0 commit comments