添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams 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 ?

events: [] as Array<any>

but it's recommended to type the response.data and the events like:

events: [] as Array<SomeEventType>
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.