当前位置:网站首页>Typescript compilation generation file comparison

Typescript compilation generation file comparison

2022-06-21 18:27:00 CupidoZ

Example 1:

Before compiling TS

let tsnum:number = 8888;
console.log(' This is a ts Precompiled js Code file ,tsnum The value is :'+tsnum);

The compiled TS(js file )

var tsnum = 8888;
console.log(' This is a ts Precompiled js Code file ,tsnum The value is :' + tsnum);

Example 2:

Before compiling TS

//  Use tsc Command compilation produces the same js Code   And run to see the effect 
//  have access to ts-node Package to precompile ts Code   Simplify the compilation process   avoid ts Recompilation caused by code changes 
//  The essence is that script mode replaces manual execution tsc command 
let num:number = 300;
console.log(num)

The compiled TS(js file )

var num = 300;
console.log(num);
原网站

版权声明
本文为[CupidoZ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206211651295131.html