In the Vuex guide it is suggested to use constants for Mutation types. I was thinking about doing this for Actions and Getters too but then I realized the guide never mentions using constants for Actions and Getters.
But why not? The advantages to using constants for Actions and Getters are pretty much the same as for Mutations. So why is this not recommended explicitly? Is there something that I am missing about why you would use them for Mutations, but not Actions and Getters?
The Vuex guide does mention using constants for actions and getters, it's just not as explicit as it is for mutations. In fact, using constants for actions and getters is generally considered best practice as well, for the same reasons that it's recommended for mutations.
When using constants for mutation types, you can use them as strings to commit mutations instead of hardcoded string values, this makes it easier to refactor and avoids typos, so it ensures that your mutations are always committed with the correct type, and makes it easy to understand what's happening in your code. This also applies for actions, you can use constants for the types of actions instead of hardcoded string values.
The same applies to Getters, you can use constants for the types of getters instead of hardcoded string values, this makes it easier to refactor and avoids typos.
It's also worth noting that using constants for all three, mutations, actions and getters, make it easier to keep the structure of your store consistent, and make it easier to understand the flow of data in your application.
The main reason the guide doesn't explicitly mention using constants for actions and getters, it's probably because it's assumed that if you're using constants for mutations, you'll naturally use them for actions and getters as well, in order to keep your code organized and consistent.