@@ -79,7 +79,7 @@ export interface CommitOptions {
}
export interface StoreOptions<S> {
- state?: S;
+ state?: S | (() => S);
getters?: GetterTree<S, S>;
actions?: ActionTree<S, S>;
mutations?: MutationTree<S>;
@@ -98,6 +98,15 @@ namespace RootDefaultModule {
});
+namespace InitialStateFunction {
+ const store = new Vuex.Store({
+ state: () => ({
+ value: 1
+ })
+ });
+ const n: number = store.state.value;
+}
+
namespace NestedModules {
interface RootState {
a: {