Quiz · Functions · lesson 10 of 10
Quiz — an overload and a union
What does tsc report for this program?
function size(x: string): number;
function size(x: number[]): number;
function size(x: string | number[]): number {
return x.length;
}
function show(v: string | number[]) {
console.log(size(v));
}
show("abc");