英文:
TS2552: Cannot find name 'PictureInPictureEvent'. Did you mean 'PictureInPictureEventHandler'?
问题
我已将我的Angular应用程序从版本14升级到版本15。
升级后,我遇到以下错误:
Error: node_modules/preact/src/jsx.d.ts:1078:3 - error TS2552: 找不到名称 'PictureInPictureEvent'。您是否想要 'PictureInPictureEventHandler'?
以及
node_modules/preact/src/jsx.d.ts:1124:3 - error TS2344: 类型 'TargetedPictureInPictureEvent<Target>' 不满足约束 'TargetedEvent<EventTarget, Event>'。
以下是配置详细信息:
{
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"target": "ES2022",
"downlevelIteration": true,
"declaration": false,
"importHelpers": true,
"lib": [
"ES2022",
"dom"
],
"module": "esnext",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"removeComments": false,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"node_modules/@types"
],
"watch": false
},
"exclude": [
"node_modules"
],
"angularCompilerOptions": {
"strictInjectionParameters": true
}
}
我在这里做错了什么?
英文:
I have upgraded my Angular app to version 15 from 14.
After upgrade I am getting following errors
Error: node_modules/preact/src/jsx.d.ts:1078:3 - error TS2552: Cannot find name 'PictureInPictureEvent'. Did you mean 'PictureInPictureEventHandler'?
And
node_modules/preact/src/jsx.d.ts:1124:3 - error TS2344: Type 'TargetedPictureInPictureEvent<Target>' does not satisfy the constraint 'TargetedEvent<EventTarget, Event>'.
Following are the config details
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
{
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"target": "ES2022",
"downlevelIteration": true,
"declaration": false,
"importHelpers": true,
"lib": [
"ES2022",
"dom"
],
"module": "esnext",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"removeComments": false,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"node_modules/@types"
],
"watch": false
},
"exclude": [
"node_modules"
],
"angularCompilerOptions": {
"strictInjectionParameters": true
}
}
<!-- end snippet -->
What am I doing wrong here?
答案1
得分: 3
你需要使用 TS 4.9+ 与 Preact v10.15.0。你可以升级你的 TS 版本或降级 Preact。
你可以参考这个链接,link。
英文:
You need to use TS 4.9+ w/ Preact v10.15.0. You can upgrade your TS version or downgrade Preact.
You can follow this link, for reference link
答案2
得分: 2
这个问题是由于TS和Preact版本不匹配引起的。
在尝试更新TS以匹配不同版本的Preact以检查兼容性后,我仍然无法解决这个问题。
对我来说解决这个问题的方法是在tsconfig.json文件的"compilerOptions"中添加以下语句:
"skipLibCheck": true
英文:
This issue is due to a version mismatch of TS and Preact.
After trying to update TS for different versions to check compatibility with Preact I was still not able to solve this.
What solved this issue for me was adding the following statement within "compilerOptions" in tsconfig.json file.
"skipLibCheck": true
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论