用typescript編譯出來的程式碼,如下:
function test(template, name, age) {
console.log(template);
console.log(name);
console.log(age);
}
let myname: string = "Keyon";
let myage: number = 18;
test`Hello, my name is ${myname}, I'm ${myage}.`;
function test(template, name, age) {
console.log(template);
console.log(name);
console.log(age);
}
var myname = "Keyon";
var myage = 18;
(_a = ["Hello, my name is ", ", I'm ", "."], _a.raw = ["Hello, my name is ", ", I'm ", "."], test(_a, myname, myage));
var _a;
(_a = ["Hello, my name is ", ", I'm ", "."], _a.raw = ["Hello, my name is ", ", I'm ", "." ], test(_a, myname, myage));這裡直接一個小括號,裡面的像參數一樣的,是什麼意思?還有那個 _a.raw 是什麼?