我正在使用TypeScript2.3,并尝试导出一个简单的常量,并在另一个文件中使用它(我在es6中已经做过无数次了)。不知何故,它不工作,我不知道出了什么问题?代码如下:
export const abc: string = "dd"; (ts1.ts)
import { abc } from './ts1'; (ts2.ts)在chrome中,在翻译后的ts1.js文件中,它显示“未捕获的语法错误;意外的令牌导出”。下面是我的tsconfig文件,如果有帮助的话:
{
"compileOnSave": true,
"compilerOptions": {
"allowJs": false,
"module": "es6",
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"target": "es5",
"types" : []
},
"include": [
"app",
"tests"
],
"exclude": [ "content", "node_modules", "bower_components", "Scripts" ],
"typeAcquisition": {
"enable": true
}有谁能帮帮我吗?
发布于 2018-02-13 14:24:40
它工作得无懈可击,你可以试着检查你的polyfills
发布于 2018-02-13 15:00:55
https://stackoverflow.com/questions/48760340
复制相似问题