Example: (TypeScript)
var a = `hello\world`;
var b = `hello\\world`;
var c = `hello\\\world`;
var d = `hello\\\\world`;
Is compiled to: (JavaScript)
var a = "helloworld";
var b = "hello\world";
var c = "hello\world";
var d = "hello\\world";
TypeScript Playground
Note that we need four backslashes in order to have a single backslash in the string value.
I tried the ES6 implementations in Chrome, Firefox and es6fiddle.net and they all treat backslashes in template strings the same way as in regular strings (i.e., two backslashes in the template results in a single backslash in the string value.).
Example: (TypeScript)
Is compiled to: (JavaScript)
TypeScript Playground
Note that we need four backslashes in order to have a single backslash in the string value.
I tried the ES6 implementations in Chrome, Firefox and es6fiddle.net and they all treat backslashes in template strings the same way as in regular strings (i.e., two backslashes in the template results in a single backslash in the string value.).