WJM
WJM

Reputation: 1191

TS2304 Cannot find name 'Set' in electron-builder

I want to use the AppUpdater in electron-builder in my Electron Application.

When importing the updater in my main.ts file:

import { autoUpdater } from "electron-updater"

The following error comes up when running the application:

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'.

After research it seems I have to show the Typescript transpiler how to deal with these particular typings but trying different combinations of targets/libraries in my ts.config file, nothing seems to help.

How can I make this typescript definition file work?

Here is my config file:

{
"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"
    ]
}

}

Upvotes: 4

Views: 357

Answers (1)

Ankur Anand
Ankur Anand

Reputation: 525

Try running npm install --save-dev @types/es6-collections

You can find more context of the solution here https://github.com/DefinitelyTyped/DefinitelyTyped/issues/16587

Upvotes: 2

Related Questions