I am currently working with a Vuex store:
type Movie = {
title: string;
id: number;
}
export default new Vuex.Store({
state: {
searchList: <Movie[]>[],
},
Upon compiling my code, an error is generated:
The error message suggests to replace '<Movie[]>' with 'as Movie[]' @typescript-eslint/consistent-type-assertions
However, I am uncertain about the correct syntax to use.
I attempted the following:
export default new Vuex.Store({
state: {
searchList as Movie[]
},
Unfortunately, this resulted in the following error:
The shorthand property 'searchList' does not have a value declared within scope. Please declare one or provide an initializer.