Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48981

Property does not exist on type 'never' in my ionic angular app

$
0
0

This is my code. I am getting id of each coach, participant and explanation and putting them in array. It is working but the same time throws errors such as

Property ‘id’ does not exist on type ‘never’. Property ‘name’ does not exist on type ‘never’.

In both functions ‘id’ and ‘name’ same error.
In my chooseName function ‘id’ does not exist in starting from line 4 and ‘name’ in line 7

I would appreciate any help! The app is on

Ionic:

Ionic CLI : 6.16.1 Ionic Framework : @ionic/angular 5.6.7 @angular-devkit/build-angular : 0.901.15 @angular-devkit/schematics : 11.2.13 @angular/cli : 11.2.13 @ionic/angular-toolkit : 2.3.3

Cordova:

Cordova CLI : 10.0.0

      chooseName(event){
    console.log(event)
    this.challenge.coach_names = [];
    this.coaches.findIndex(x => x.id === event.detail.value[0])
    console.log(this.coaches[this.coaches.findIndex(x => x.id === event.detail.value[0])])
    for (var coach of event.detail.value) {
      console.log((this.coaches[this.coaches.findIndex(x => x.id === coach)]))
      this.challenge.coach_names.push(this.coaches[this.coaches.findIndex(x => x.id === coach)].name)
      }
      console.log(this.challenge.coach_names)
}

  chooseParticipant(event){
    console.log(event)
    this.challenge.participant_names = [];
    this.participants.findIndex(x => x.id === event.detail.value[0])
    console.log(this.participants[this.participants.findIndex(x => x.id === event.detail.value[0])])
    for (var participant of event.detail.value) {
      console.log((this.participants[this.participants.findIndex(x => x.id === participant)]))
      this.challenge.participant_names.push(this.participants[this.participants.findIndex(x => x.id === participant)].name)
      }
      console.log(this.challenge.participant_names)
}

Both functions are triggered with ionChange and it is weird I can run my app with these mentioned errors. I would appreciate any help

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48981

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>