相关文章推荐
酒量大的板栗  ·  log4j ...·  1 周前    · 
拉风的楼房  ·  JDeveloper IDE 绠��·  4 周前    · 
烦恼的手术刀  ·  JsonConvert.SerializeO ...·  3 月前    · 
温柔的西瓜  ·  svg 转 base64 img_svg ...·  1 年前    · 
失恋的柿子  ·  Pycharm debug ...·  1 年前    · 
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.