The Missing Bit

Template literals in Typescript
February 17, 2017
Updated: February 22, 2018


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 ).

If you wish to comment or discuss this post, just mention me on Twitter.