gpt4 book ai didi

angular - 接口(interface) 'HTMLIonIconElement' 不能同时扩展类型 'IonIc on' 和 'HTMLStencilElement'

转载 作者:行者123 更新时间:2023-12-05 02:37:34 27 4
gpt4 key购买 nike

我刚刚通过运行 ng update 将我的 angular ionic 应用程序升级为使用 angular 12 的 angular v13。更新成功但现在我无法运行应用程序并出现以下错误

[ng] Error: node_modules/ionicons/dist/types/components.d.ts:66:15 - error TS2320: Interface 'HTMLIonIconElement' cannot simultaneously extend types 'IonIc
on' and 'HTMLStencilElement'.
[ng] Named property 'ariaHidden' of types 'IonIcon' and 'HTMLStencilElement' are not identical.
[ng]
[ng] 66 interface HTMLIonIconElement extends Components.IonIcon, HTMLStencilElement {
[ng] ~~~~~~~~~~~~~~~~~~
[ng]
[ng]
[ng] Error: node_modules/ionicons/dist/types/components.d.ts:66:15 - error TS2320: Interface 'HTMLIonIconElement' cannot simultaneously extend types 'IonIc
on' and 'HTMLStencilElement'.
[ng] Named property 'ariaLabel' of types 'IonIcon' and 'HTMLStencilElement' are not identical.
[ng]
[ng] 66 interface HTMLIonIconElement extends Components.IonIcon, HTMLStencilElement {
[ng] ~~~~~~~~~~~~~~~~~~
[ng]
[ng]
[ng] Error: node_modules/typescript/lib/lib.dom.d.ts:4632:101 - error TS2344: Type 'HTMLElementTagNameMap[K]' does not satisfy the constraint 'Element'.
[ng] Type 'HTMLElement | HTMLMetaElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | ... 151 more ... | HTMLMarqueeElement' is not assigna
ble to type 'Element'.
[ng] Type 'HTMLIonIconElement' is not assignable to type 'Element'.
[ng] Property 'ariaHidden' is optional in type 'HTMLIonIconElement' but required in type 'Element'.
[ng]
[ng] 4632 getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
[ng] ~~~~~~~~~~~~~~~~~~~~~~~~
[ng]
[ng]
[ng] Error: node_modules/typescript/lib/lib.dom.d.ts:4953:101 - error TS2344: Type 'HTMLElementTagNameMap[K]' does not satisfy the constraint 'Element'.
[ng] Type 'HTMLElement | HTMLMetaElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | ... 151 more ... | HTMLMarqueeElement' is not assigna
ble to type 'Element'.
[ng]
[ng] 4953 getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
[ng]

问题是所有被提示的文件都在 node_modules 目录中。我该如何解决这个问题?

最佳答案

好像是ng update更新了typescript版本到4.4,但是ionic ion-icon好像和这个版本的typescript不兼容。

我使用的当前修复是恢复到 typescript 版本 4.3.5

如何执行此降级:

更新你的 package.json ->替换:“ typescript ”:“~4.4.4”使用 "typescript": "~4.3.5"

然后运行 -> npm install

如果有人有更多关于这种不兼容的根本原因以及解决此问题的其他方法的信息,我非常感兴趣,因为我非常想升级到 typescript 4.4。

关于angular - 接口(interface) 'HTMLIonIconElement' 不能同时扩展类型 'IonIc on' 和 'HTMLStencilElement',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69928845/

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