导入下划线typescript @types文件时出错

时间:2017-08-05 20:19:40

标签: typescript underscore.js gulp-typescript

我在应用程序中添加了包 @ types / underscore ,并将ts包更新为 2.4.2 版本,但是如果我尝试编译我收到了错误消息:

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.

对应

export as namespace _;

这些是ts参数:

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

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

我错过了什么?

1 个答案:

答案 0 :(得分:0)

您的gulp-typescript似乎已过期。我们可以这样更新:

npm update gulp-typescript --save-dev