Skip to content
Quiz · Unions and literal types · lesson 2 of 8

Quiz — a shared method

On which line does tsc report an error?

TypeScript
function show(id: string | number) {
    console.log(id.toString());
    console.log(id.length);
}

show(42);