Function Overloads
Overloads declare several call signatures for one implementation.
Example
function wrap(x: string): string[];
function wrap(x: number): number[];
function wrap(x: any) { return [x]; }
console.log(wrap("a"), wrap(1));Result
[ "a" ] [ 1 ]
Exercise
Overload count.
Overloads share one Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.