TS2304找不到名称' Set'在电子建设者

时间:2017-12-16 17:54:27

标签: javascript typescript electron-builder

我想在电子申请中使用电子工程师中的AppUpdater。

在我的main.ts文件中导入更新程序时:

import { autoUpdater } from "electron-updater"

运行应用程序时出现以下错误:

node_modules/builder-util-runtime/out/httpExecutor.d.ts(54,69): error TS2304: Cannot find name 'Set'.
node_modules/builder-util-runtime/out/rfc2253Parser.d.ts(1,47): error TS2304: Cannot find name 'Map'.

经过研究,似乎我必须向Typescript转换器展示如何处理这些特定的类型,但在我的ts.config文件中尝试不同的目标/库组合,似乎没有任何帮助。

如何使这个打字稿定义文件有效?

这是我的配置文件:

{
"compileOnSave": false,
"compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowJs": false,
    "target": "es5",
    "paths": {
        "environments": [
            "./environments"
        ]
    },
    "types": [
        "node",
        "jasmine"
    ],
    "typeRoots": [
        "node_modules/@types"
    ],
    "lib": [
        "es2016",
        "dom"
    ]
}

}

1 个答案:

答案 0 :(得分:1)

尝试跑步 npm install --save-dev @types/es6-collections

您可以在https://github.com/DefinitelyTyped/DefinitelyTyped/issues/16587

中找到解决方案的更多背景信息