Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: [Angular][TypeScript] Incorrect "ionScroll" event typing #24392

Closed
4 of 6 tasks
hakimio opened this issue Dec 14, 2021 · 2 comments
Closed
4 of 6 tasks

bug: [Angular][TypeScript] Incorrect "ionScroll" event typing #24392

hakimio opened this issue Dec 14, 2021 · 2 comments
Labels

Comments

@hakimio
Copy link

hakimio commented Dec 14, 2021

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

Correctly typed ion-content ionScroll event handler like in the following example fails to compile in production build when Angular strictTemplates are enabled in tsconfig.json (default behavior for new Angular v12 and v13 projects).

onContentScroll(scrollEvent: CustomEvent<ScrollDetail>) {
    // some code
}

Angular expects scrollEvent to be typed as Event, but it's actually CustomEvent.
Error:

Argument of type 'Event' is not assignable to parameter of type 'CustomEvent<ScrollDetail>'.
Type 'Event' is missing the following properties from type 'CustomEvent<ScrollDetail>': detail, initCustomEvent

Expected Behavior

Production build should succeed without any errors when Angular strictTemplates are enabled.

Steps to Reproduce

  • Enable Angular strictTemplates
  • Set correct typing for your ion-content scroll event argument (CustomEvent<ScrollDetail>)
  • Try to compile production build of your Angular app.

Code Reproduction URL

No response

Ionic Info

Ionic CLI : 6.18.1
Ionic Framework : @ionic/angular 6.0.0
@angular-devkit/build-angular : 13.0.2
@angular-devkit/schematics : 13.0.2
@angular/cli : 13.0.2
@ionic/angular-toolkit : 5.0.4-testing.4

Capacitor:

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

Utility:

cordova-res : 0.15.3
native-run : 1.5.0

System:

NodeJS : v14.18.1
npm : 7.24.2
OS : Windows 10

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Dec 14, 2021
@liamdebeasi liamdebeasi self-assigned this Dec 14, 2021
@liamdebeasi liamdebeasi added the needs: reply the issue needs a response from the user label Dec 14, 2021
@ionitron-bot ionitron-bot bot removed the triage label Dec 14, 2021
@liamdebeasi
Copy link
Contributor

Thanks for the issue. I am going to close this as a duplicate of #24245.

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Dec 14, 2021
@liamdebeasi liamdebeasi removed their assignment Dec 14, 2021
@ionitron-bot
Copy link

ionitron-bot bot commented Jan 13, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jan 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants