November 2018
Beginner
502 pages
10h 22m
English
Tuple function parameters in TypeScript 3 allow us to create strongly-typed rest parameters.
Time for an example:
function logScores(...scores) { console.log(scores);}
function logScores(...scores: [...number[]]) { console.log(scores);}
logScores(50, 85, 75);
We don't get a compiler error, and if we run the program, we get an array containing 50, 85, 75 output in the console. ...
Read now
Unlock full access