【发布时间】:2019-02-27 07:14:57
【问题描述】:
我有 Electron + Angular 应用程序。我想为 Electron 使用 Typescript,所以我有 main.ts 文件并想使用“tsc main.ts”将其编译为 main.js。但是,我收到以下错误:
node_modules/@types/selenium-webdriver/remote.d.ts:139:29 - 错误 TS2304:找不到名称“地图”。
仍然会生成 main.js,并且可以在我在没有 tsc 命令的情况下运行电子时使用。但是,我希望它由一个脚本运行而不会出现任何错误。
我的 tsconfig.json 包含:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
我已经尝试过各种目标和 lib 配置组合(例如 es6),但没有成功。
有人可以帮忙吗? 非常感谢!
【问题讨论】:
-
您的目标和库属性很好。这可能与typeRoots有关。也许该库取决于 nodejs 类型的版本或其他东西,并且由于多个版本而安装在子目录中
标签: angular typescript electron