title: Vuex-module-decorator, modifying state inside an action
body: <p>Using the <em>vuex-module-decorator</em> I have a <code>authenticate</code> action that should mutate the state.</p>
  
  <pre><code>@Action
  public authenticate(email: string, password: string): Promise&lt;Principal&gt; {
      this.principal = null;
      return authenticator
        .authenticate(email, password)
        .then(auth =&gt; {
            const principal = new Principal(auth.username);
            this.context.commit('setPrincipal', principal);
            return principal;
        })
        .catch(error =&gt; {
            this.context.commit('setError', error);
            return error;
        });
  }
  
  // mutations for error and principal
  </code></pre>
  
  <p>But this fail with the following message:</p>
  
  <blockquote>
    <p>Unhandled promise rejection Error: "ERR_ACTION_ACCESS_UNDEFINED: Are you trying to access this.someMutation() or this.someGetter inside an @Action? 
    That works only in dynamic modules. 
    If not dynamic use this.context.commit("mutationName", payload) and this.context.getters["getterName"]</p>
  </blockquote>
  
  <p>What I don't understand is that it works well with <code>@MutationAction</code> and <code>async</code>. However I miss the return type <code>Promise&lt;Principal&gt;</code>.</p>
  
  <pre><code>@MutationAction
  public async authenticate(email: string, password: string) {
      this.principal = null;
      try {
          const auth = await authenticator.authenticate(email, password);
          return { principal: new Principal(auth.username), error: null };
      } catch (ex) {
          const error = ex as Error;
          return { principal: null, error };
      }
  }
  </code></pre>
  
  <p>--</p>
  
  <p>At this time I feel blocked and would like to have some help to implement an <code>@Action</code> that can mutate the state and return a specific type in a <code>Promise</code>.</p>