title: How to use Vuex types constants with module namespace?
body: <p>I have this Vuex module:</p>
  
  <pre><code>//modules/things.js
  const state = {
    firstThing: 'abc',
    secondThing: 'def',
  };
  
  const getters = {
    getFirstThing: state =&gt; state.firstThing,
    getSecondThing: state =&gt; state.secondThing,
  };
  
  const mutations = {
    setFirstThing: (state, payload) =&gt; state.firstThing = payload,
    setSecondThing: (state, payload) =&gt; state.secondThing = payload
  };
  
  const actions = {};
  
  export default {
    namespaced: true,   // &lt;------
    state,
    mutations,
    actions,
    getters
  };
  </code></pre>
  
  <p>I use <code>namespaced: true</code> <a href="https://vuex.vuejs.org/en/modules.html#namespacing" rel="noreferrer">flag</a> and can work with this module like this:</p>
  
  <pre><code>this.$store.state.things.firstThing             // &lt;-- return abc here
  this.$store.commit('things/setFirstThing', 10)
  this.$store.getters['things/getFirstThing']     // &lt;-- return abc here
  </code></pre>
  
  <p>If I will use constants like in Vuex <a href="https://github.com/vuejs/vuex/blob/dev/examples/shopping-cart/store/mutation-types.js" rel="noreferrer">official example</a>, and refactor my <code>modules/things.js</code> file like this:</p>
  
  <pre><code>export const Types = {
    getters: {
      GET_FIRST_THING: 'GET_FIRST_THING',
      GET_SECOND_THING: 'GET_SECOND_THING',
    },
    mutations: {
      SET_FIRST_THING: 'SET_FIRST_THING',
      SET_SECOND_THING: 'SET_SECOND_THING',
    }
  };
  
  const getters = {
    [Types.getters.GET_FIRST_THING]: state =&gt; state.firstThing,
    [Types.getters.GET_SECOND_THING]: state =&gt; state.secondThing,
  };
  
  const mutations = {
    [Types.mutations.SET_FIRST_THING]: (state, payload) =&gt; state.firstThing = payload,
    [Types.mutations.SET_SECOND_THING]: (state, payload) =&gt; state.secondThing = payload
  };
  </code></pre>
  
  <p>I will have to use namespace prefix: </p>
  
  <pre><code>this.$store.commit('things/' + Types.mutations.SET_FIRST_THING, 10);
  this.$store.getters['things/' +  + Types.getters.GET_FIRST_THING]  
  </code></pre>
  
  <p>If I will include module namespace prefix to <code>Types</code> constant, I will have to use string prefix <code>things/</code> for mutations/actions/getters declaration:</p>
  
  <pre><code>const getters = {
    ['things/' + Types.getters.GET_FIRST_THING]: state =&gt; state.firstThing,
    ['things/' + Types.getters.GET_SECOND_THING]: state =&gt; state.secondThing,
  };
  </code></pre>
  
  <p>How to avoid that?</p>