Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

typescript cast number type to never [duplicate]

$
0
0
r = Math.floor(Math.random() * arrOfCourse.length) + 1;if (arr.indexOf(r) === -1) arr.push(r);

I got this error on the r Argument of type 'number' is not assignable to parameter of type 'never'.

enter image description here

I'm suppose to cast r ? If I try to do:r:any = Math.floor(Math.random() * arrOfCourse.length) + 1; nothing change...


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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