P
P
Peter Sergeev2022-03-27 12:20:18
typescript
Peter Sergeev, 2022-03-27 12:20:18

How to typescript volume action inputs in vuex 4 (vue 3)?

parameters such as commit, getters, rootGetters, etc.
Here is an example, now everyone has type any, but any is not recommended to use yet

*****
  actions: {
   async updateData({ commit, getters, rootGetters }: any, toUpdate: string) {
    *******
  }
 }
*****

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wonderingpeanut, 2022-03-27
@223606322

type UpdateDataActions = {
  commit: string;
  getters: (() => void)[];
  rootGetters: (() => void)[];
}
... async updateData({commit,getters,rootGetters}:UpdateDataActions, toUpdate: string) {...}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question