【问题标题】:TS2304 Cannot find name 'Set' in electron-builderTS2304 在电子生成器中找不到名称“Set”
【发布时间】:2018-05-30 14:45:39
【问题描述】:

我想在我的 Electron 应用程序中使用 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"
    ]
}

}

【问题讨论】:

  • 请告诉我 electron-builder 的版本

标签: javascript typescript electron-builder


【解决方案1】:

尝试运行 npm install --save-dev @types/es6-collections

您可以在此处找到解决方案的更多上下文 https://github.com/DefinitelyTyped/DefinitelyTyped/issues/16587

【讨论】:

    猜你喜欢
    • 2019-04-21
    • 2017-11-26
    • 2020-01-08
    • 1970-01-01
    • 2022-01-20
    • 2017-08-11
    • 2017-08-23
    • 1970-01-01
    • 2017-11-03
    相关资源
    最近更新 更多