Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

89
Views
Typescript ES2022 function call

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?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!