Template literals in Typescript

Nicolas Goy
The missing bit
Published in
1 min readFeb 17, 2017

It might be common knowledge, but I just discovered that Typescript was supporting JavaScript template literals.

Also called string interpolation sometimes, it let you do something like:

name = "John"console.log(`Hello ${name}`)

And it will print “Hello John”.

The nice thing about it is that Typescript will generate es5 compatible code (if target is set to es5 in your tsconfig.json ).

--

--