Problems with Korean conversion when converting ts -> js in typescript (especially when using 'template string')

Asked 2 years ago, Updated 2 years ago, 122 views

While following the Gulp section on the TypeScript home page.

On the example code, there is a template string as shown above, and change this code as follows.

// File name: src/main.ts
function hello(compiler: string) {
    console.log ("Hi");
    console.log ("Hi 2");
    console.log(`Hello from ${compiler}`);
}
hello('TypeScript');

I ran gulp and saw ts -> js converted code...

// File name: dist/main.js
function hello(compiler) {
    console.log ("Hi");
    console.log ("Hi 2");
    console.log("\uC548\uB155 from " + compiler);
}
hello('TypeScript')

As shown in , only Korean in template string has been changed to Unicode.

Of course, the result of node dist/main.js is well printed in Korean, but... Is there a way to convert the Korean of the template string into the Korean like other Korean of the regular string?

typescript korean unicode node.js

2022-09-20 22:02

1 Answers

First of all, the unicode escaped is a problem-free JavaScript code. After searching for related issues, it seems that the type script compiler does not support related options separately, and unnecessary escapes from the compiler need to be removed.

https://github.com/microsoft/TypeScript/issues/36174


2022-09-20 22:02

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.