Out of curiosity I checked the generated javascript with typescript target configured to ES2022 and I saw something like this:
function leFormat(a) { console.log(`yes`, a) }
(0, leFormat)(new Date())
Why typescript chooses to do this? Why not just?:
leFormat(new Date())
Also, between parentheses values separated by comma will return the last one
a = (0, 1, '', null, console.log, undefined) // a === undefined
typeof (0, 1, '', null, console.log, undefined) === 'object'
(0, 1, '', null, console.log, undefined).toString() // TypeError: undefined has no properties
Is there a use for this, or is it just a quirk of the language?