1

I am trying to write a function in typescript. But it is showing an error like “not assignable to parameter of type never”

@Input('starCount') public starCount: number = 5;


  showStars() {
    for (let index = 0; index < this.starCount; index++) {
      this.ratingArr.push(index);
    }
  }
Shovon
  • 47
  • 1
  • 7
  • 1
    What is showing the error? Is it runtime or compile time? What line is showing the error? – JeffryHouser Jun 20 '21 at 12:45
  • @JeffryHouser I fixed the problem. I appreciate your concern. Actually the problem was : When I was pushing index into ratingArr then it was showing error like “not assignable to parameter of type never”.The problem was in declaring ratingArr. "ratingArr = [ ]" my first declaration was like this. But It was fixed after declaring as "ratingArr : [ ] = [ ]" . Just after moved to any type from never! – Shovon Jun 23 '21 at 04:46

0 Answers0