My goal is to merge two arrays into one using the spread object method as shown in the code snippet below:
const queryVariable = {
...this.state,
filters: [...Object.keys(extraFilters || {}), ...this.state.filters],
}
The this.state.filters
variable represents an array in this case. However, TypeScript is throwing the following error message:
Type must have a '[Symbol.iterator]()' method that returns an iterator.
I'm not sure what I'm doing incorrectly here. Can someone help provide guidance on how to correct this issue?