How to convert a number type to a string type in TypeScript
To convert a number type to a string type in TypeScript, use ${} for easy conversion.
let a:number = 100; let b:any = `${a}`; // as ${a}, enclose in backquotes console.log(typeof b); // displayed as string
Of course, it is possible to change type number to type string as String(a).
コメント