PacktPublishing / -Vue.js-3-By-Example

Vue.js 3 By Example, published by Packt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mutation definition with parameter destructuring in chapter 5

clockwiser opened this issue · comments

In chapter 5, there is a mutation definition like below.

mutations: {
addToHistory(state: { history: HistoryEntry[] }, entry: HistoryEntry) {
state.history.push(entry)
},

What is this "state: { history: HistoryEntry[] } "?
Searched around but couldn't find any reliable explanation.

There is parameter destructuring explained here.
https://www.typescriptlang.org/docs/handbook/2/functions.html#parameter-destructuring
But it is not the same beast.