gpt4 book ai didi

Error reported when WebWorker and Dom are both introduced into tsconfig.json(在tsconfig.json中同时引入WebWorker和DOM时报告错误)

转载 作者:bug小助手 更新时间:2023-10-26 20:32:50 27 4
gpt4 key购买 nike



In the ts project, I introduced dom and WebWorker in compilerOptions -> lib of the tsconfig.json file and then compiled and reported an error.
Below is the tsconfig.json file:

在ts项目中,我在tsconfig.json文件的编译器选项->lib中引入了dom和WebWorker,然后编译并报告了一个错误。以下是tsconfig.json文件:


{
"compilerOptions": {
"lib": ["ES2015", "DOM", "WebWorker"],
"module": "ES2015",
"target": "ES5",
"outDir": "dist",
"sourceMap": false,
"strict": true,
"moduleResolution": "Node",
"esModuleInterop": true,
"preserveConstEnums": true,
"downlevelIteration": true
},
"include": ["src"],
"exclude": ["node_modules"]
}

The error is reported as follows:

错误报告如下:


node_modules/typescript/lib/lib.webworker.d.ts:5725:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'self' must be of type 'Window & typeof globalThis', but here has type 'WorkerGlobalScope & typeof globalThis'.

5725 declare var self: WorkerGlobalScope & typeof globalThis;
~~~~

node_modules/typescript/lib/lib.dom.d.ts:17364:13
17364 declare var self: Window & typeof globalThis;
~~~~
'self' was also declared here.

I don't know the reason and how to fix it

我不知道原因,也不知道怎么解决


更多回答
优秀答案推荐
更多回答

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com