1
在打字稿中,如何告诉编译器实际输出类,常量,允许等,而不是将所有内容都转换为变量和函数?我正在使用Typescript 2.4.1。TypeScript输出ES5代码
这里是我的tsconfig:
{
"compilerOptions": {
/* Basic Options */
"target": "es2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"module": "es2015", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"moduleResolution": "node",
"strict": false, /* Enable all strict type-checking options. */
"lib": [
"es2015",
"dom",
"es2016",
"es2017"
],
"alwaysStrict": true
}
}
你的编译器选项看起来不错,你确定那是使用的配置吗? –
瞧!原来'tsc MyFile.ts'显然不使用当前目录中的tsconfig.json文件。如果你喜欢的话,把它放在一个答案中。 –