DEV Community

Discussion on: Fake tagged template string literal to enable syntax highlighting in VSCode

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

It's literally what template string tags are -- functions.

You have to try this in your console.

function foo(...args) {
  console.log(JSON.stringify(args))
}

foo`a${1}b${2}c${3}d`

I get

[["a","b","c","d"],1,2,3]

The first arg is always an array of strings, and the latter args are objects, in their native form.