Typescript ternary evaluation [duplicate]

Would like to ask does anyone know how typescript evaluate the below ternary condition

let str = "asd/asd";
let nodeId = null;


console.log(`${str}` + nodeId? "a":"b"); // Output "a" instead of "asd/asda"

The output i try in typescript editor it show as “a”. Wouldn’t it be “asd/asda”?

Once i enclose the condition like this

let str = "asd/asd";
let nodeId = null;


console.log(`${str}` + (nodeId? "a":"b")); // Output "asd/asda"

It display as “asd/asda”