2017-08-05 51 views
0

我加入了包@类型/应用程序中的下划线,并更新了TS包到2.4.2版本,但如果我尝试编译我收到错误信息:对应于错误导入强调打字稿@types文件

export as namespace _; 

node_modules\@types\underscore\index.d.ts(8,1): error TS1128: Declaration or statement expected. 
node_modules\@types\underscore\index.d.ts(8,11): error TS1005: ';' expected. 
node_modules\@types\underscore\index.d.ts(8,22): error TS1005: '{' expected. 

这些是TS参数:

.pipe(tsc({ 
    target: 'ES6', 
    declarationFiles: false, 
    noExternalResolve: true, 

    inlineSources: true, 
    inlineSourceMap: true, 
    types: [ "underscore", "cordova-plugin-camera" ] 
})) 

我错过了什么?

+0

我一直无法重新创建您遇到的错误。你如何安装下划线类型?即你使用'npm install @ types/underscore'来做到这一点吗?你如何构建TypeScript?即例如,你是否使用gulp-typescript?您是否尝试过直接使用TypeScript'tsc'编译器从命令行构建TypeScript? –

+1

看起来像问题是我不得不更新吞口打字稿。现在我不再有这个错误 –

回答

0

它看起来像你的gulp-typescript是过时的。我们可以这样更新:

npm update gulp-typescript --save-dev