
最近上班比较闲, 开始学 ts, 跟着教程生成 tsconfig.json 后发现修改里面的设置却不起作用, 只能用命令行参数
ts 文件代码如下:
function Hello(person: string){ return `Hello ${person}`; } const user= "sdfsdf"; console.log(Hello(user)); 生成的 js 文件如下:
function Hello(person) { return "Hello " + person; //tsconfig.json 的 target 改为 es6 无效果, 然后用 tsc hello.ts -t es6 则正常 } var user = "sdfsdf"; console.log(Hello(user)); tsc -p ./tsconfig.json 命令试过了, 没有用
请问是什么原因呢?
1 wszgrcy 2020 年 4 月 26 日 via Android tsconfig 发下。。。 |