I'm using vue on Ionic and have my code like this :
data() {
return {
events: []
};
},
The template :
<CardEvent
v-for="event of events"
:key="event.event_ID"
@click="router.push(`/home/evenement/` + event.event_ID)"
button
:title="event.event_title"
:picture="event.event_picture"
:addressExists="event.address_exists"
:day="event.event_day"
:month="event.event_month"
:isVirtual="event.is_virtual"
/>
I have a method to push to my events array :
loadMore() {
//Data here
this.events.push(response.data); // => error here
},
On this line I got the error "Argument of type 'any' is not assignable to parameter of type 'never'
"
I saw that we can do something like : const result : string[] = [];
but how to achieve this with the data object ?
You could define your data property as Array<any>
events: [] as Array<any>
but it's recommended to type the response.data
and the events
like:
events: [] as Array<SomeEventType>