ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: TS2320: Interface 'HTMLIonInputElement' cannot simultaneously extend types 'IonInput' and 'HTMLStencilElement'

Open emeryao opened this issue 5 months ago • 13 comments

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

since angular 20.2.0 released recently and typescript v5.9 is being supported

I upgraded dependencies of my project and the message pop up when serving the project

X [ERROR] TS2320: Interface 'HTMLIonInputElement' cannot simultaneously extend types 'IonInput' and 'HTMLStencilElement'.
  Named property 'autocorrect' of types 'IonInput' and 'HTMLStencilElement' are not identical. [plugin angular-compiler]

    node_modules/@ionic/core/dist/types/components.d.ts:4326:14:
      4326 │     interface HTMLIonInputElement extends Components.IonInput, H...

X [ERROR] TS2320: Interface 'HTMLIonSearchbarElement' cannot simultaneously extend types 'IonSearchbar' and 'HTMLStencilElement'.
  Named property 'autocorrect' of types 'IonSearchbar' and 'HTMLStencilElement' are not identical. [plugin angular-compiler]

    node_modules/@ionic/core/dist/types/components.d.ts:4888:14:
      4888 │     interface HTMLIonSearchbarElement extends Components.IonSear...

and my project went well with [email protected].* and [email protected].*

Expected Behavior

Success to build and serve

Steps to Reproduce

  1. update deps with [email protected] and [email protected]
  2. try to serve with npx ng serve

Ionic Info

Ionic:

Ionic CLI : 7.2.1 (C:\Users\USER\AppData\Local\npm-cache_npx\f6fddb685269761d\node_modules@ionic\cli) Ionic Framework : @ionic/angular 8.7.2 @angular-devkit/build-angular : not installed @angular-devkit/schematics : 20.2.0 @angular/cli : 20.2.0 @ionic/angular-toolkit : not installed

Capacitor:

Capacitor CLI : 7.4.2 @capacitor/android : 7.4.2 @capacitor/core : 7.4.2 @capacitor/ios : not installed

Utility:

cordova-res : not installed globally native-run : 2.0.1

System:

NodeJS : v24.6.0 (C:\Program Files\nodejs\node.exe) npm : 11.5.2 OS : Windows 10


Sorry for my poor English 😆

emeryao avatar Aug 21 '25 07:08 emeryao

Image

Facing same issue in new app.

{
  "dependencies": {
    "@angular/animations": "^20.0.0",
    "@angular/common": "^20.0.0",
    "@angular/compiler": "^20.0.0",
    "@angular/core": "^20.0.0",
    "@angular/forms": "^20.0.0",
    "@angular/platform-browser": "^20.0.0",
    "@angular/platform-browser-dynamic": "^20.0.0",
    "@angular/router": "^20.0.0",
    "@angular/service-worker": "^20.0.0",
    "@capacitor/android": "7.4.3",
    "@capacitor/app": "7.0.2",
    "@capacitor/core": "7.4.3",
    "@capacitor/haptics": "7.0.2",
    "@capacitor/ios": "7.4.3",
    "@capacitor/keyboard": "7.0.2",
    "@capacitor/status-bar": "7.0.2",
    "@ionic/angular": "^8.0.0",
    "firebase-tools": "^14.14.0",
    "ionicons": "^7.0.0",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.15.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^20.0.0",
    "@angular-eslint/builder": "^20.0.0",
    "@angular-eslint/eslint-plugin": "^20.0.0",
    "@angular-eslint/eslint-plugin-template": "^20.0.0",
    "@angular-eslint/schematics": "^20.0.0",
    "@angular-eslint/template-parser": "^20.0.0",
    "@angular/cli": "^20.0.0",
    "@angular/compiler-cli": "^20.0.0",
    "@angular/language-service": "^20.0.0",
    "@capacitor/cli": "7.4.3",
    "@ionic/angular-toolkit": "^12.0.0",
    "@types/jasmine": "~5.1.0",
    "@typescript-eslint/eslint-plugin": "^8.18.0",
    "@typescript-eslint/parser": "^8.18.0",
    "eslint": "^9.16.0",
    "eslint-plugin-import": "^2.29.1",
    "eslint-plugin-jsdoc": "^48.2.1",
    "eslint-plugin-prefer-arrow": "1.2.3",
    "jasmine-core": "5.9.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.1.0",
    "typescript": "5.9.2"
  },
}

Hope we get fix soon. Message for the testing team, atleast test once before release.

IAM5K avatar Aug 23 '25 18:08 IAM5K

FYI you can force a build by adding "skipLibCheck": true to your tsconfig.json's compilerOptions, but also hoping this gets resolved soon.

loganmurray-infor avatar Aug 25 '25 13:08 loganmurray-infor

Facing same issue in new app

pedrodominguesp avatar Aug 25 '25 15:08 pedrodominguesp

FYI you can force a build by adding "skipLibCheck": false to your tsconfig.json's compilerOptions, but also hoping this gets resolved soon.

You need to add "skipLibCheck": true

davidsarkany avatar Aug 26 '25 14:08 davidsarkany

You need to add "skipLibCheck": true

Whoops, corrected.

loganmurray-infor avatar Aug 26 '25 15:08 loganmurray-infor

Thanks for the issue!

You should be able to work around this by downgrading TypeScript:

npm i [email protected] --save-exact

brandyscarney avatar Aug 28 '25 18:08 brandyscarney

Confirmed downgrade to [email protected] worked in my case. Thank you much!

brysonreese avatar Aug 28 '25 18:08 brysonreese

This fixed the issue for me, works fine with [email protected] too. Thanks!

SoraNoIseki avatar Sep 03 '25 09:09 SoraNoIseki

Hi everyone! I wanted to share an update on why this issue is happening, what needs to be done to resolve it, and what we recommend in the meantime.

Why this is happening

TypeScript 5.9 introduced a new property, HTMLElement.autocorrect, defined as a boolean. This conflicts with Stencil's existing autocorrect type, which follows the global autocorrect and is defined as a string.

Why this only affects Angular (not React or Vue)

Angular is currently the only framework that doesn't use skipLibCheck in its tsconfig.json in both our starters and our docs examples. React and Vue are not running into this because their configs already include skipLibCheck. I'll be updating the Angular starters and docs to include this as well.

What we are doing to fix it

The permanent fix needs to happen in Stencil. We've created an internal task to upgrade Stencil for TypeScript 5.9 support. We don't have an ETA until work begins, but once complete, we'll update Stencil in Ionic Framework and resolve this issue.

What we recommend in the meantime

If you want to use TypeScript 5.9, add the following to your tsconfig.json:

"compilerOptions": {
  "skipLibCheck": true,
},

If you want to pin TypeScript to the last version that works, you can install it with:

npm i [email protected] --save-exact

We will update this issue once there is a permanent fix. Thank you!

brandyscarney avatar Sep 04 '25 18:09 brandyscarney

FYI you can force a build by adding "skipLibCheck": true to your tsconfig.json's compilerOptions, but also hoping this gets resolved soon.

cool, but what happens when there are actual issues with declaration files? Does this hide all issues?

snolan-ethika avatar Sep 10 '25 18:09 snolan-ethika

looks like Stencil fixed it and upgraded to typescript 5.9

lecousin avatar Nov 14 '25 04:11 lecousin

And the TS update was reverted because of Ionic: https://github.com/stenciljs/core/pull/6444

hakimio avatar Nov 14 '25 07:11 hakimio

Small update -

We tried to resolve this after upgrading Stencil to TypeScript 5.9 by overriding the autocorrect type. When that introduced issues, we tried only omitting the autocorrect type instead. Unfortunately, both approaches caused issues for other Stencil projects and we had to revert the upgrade entirely.

At this point, the likely path forward is to update Ionic Framework's autocorrect type in Input and Searchbar to use a boolean. This will be a breaking change so we can't do this until Ionic Framework v9. However, we are actively working on v9 and the latest TypeScript support is still a top priority.

brandyscarney avatar Nov 14 '25 17:11 brandyscarney