content: ion-tabs in angular doesn't use the custom event interface
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- angular, typescript
- Domain
- frontend
Research direction
Start with core/src/components/tabs/tabs-interface.ts and core/src/components/tabs/tabs.tsx, then inspect how the Angular binding exposes ionTabsWillChange and ionTabsDidChange. Verify the event handler type with the Angular template example; done means the handler accepts TabsCustomEvent without the reported TypeScript error.
Written by the indexing model from the issue text.
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v7.x
Current Behavior
ion-tabs has a custom event TabsCustomEvent but its not used anywhere:
export interface TabsCustomEvent extends CustomEvent {
detail: { tab: string };
target: HTMLIonTabsElement;
}
The two events on the component just define their own object:
/**
* Emitted when the navigation is about to transition to a new component.
*/
@Event({ bubbles: false }) ionTabsWillChange!: EventEmitter<{ tab: string }>;
/**
* Emitted when the navigation has finished transitioning to a new component.
*/
@Event({ bubbles: false }) ionTabsDidChange!: EventEmitter<{ tab: string }>;
Expected Behavior
It should use the custom event.
Steps to Reproduce
Define an ion-tab and attempt to handle the event on it such as:
Markup
<ion-tabs (ionTabsDidChange)="onTabsDidChange($event)">
</ion-tabs>
Code
onTabsDidChange(event: TabsCustomEvent) {
}
Error
Argument of type '{ tab: string; }' is not assignable to parameter of type 'TabsCustomEvent'.
Type '{ tab: string; }' is missing the following properties from type 'TabsCustomEvent': detail, target, initCustomEvent, bubbles, and 20 more.ngtsc(2345)
tabs.page.ts(6, 3): Error occurs in the template of component TabsPage.
Code Reproduction URL
No response
Ionic Info
Ionic:
Ionic CLI : 7.1.5 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 7.6.6
@angular-devkit/build-angular : 16.2.12
@angular-devkit/schematics : 16.2.12
@angular/cli : 16.2.12
@ionic/angular-toolkit : 9.0.0
Capacitor:
Capacitor CLI : 5.6.0
@capacitor/android : 5.6.0
@capacitor/core : 5.6.0
@capacitor/ios : 5.6.0
Utility:
cordova-res : not installed globally
native-run : 2.0.1
System:
NodeJS : v18.12.0 (/usr/local/bin/node)
npm : 8.19.2
OS : macOS Unknown
Additional Information
No response
- Dominant language
- MDX
- Stars
- 621
- Forks
- 3.2k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 86
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ionic-team/ionic-docs
-
content
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
ionic-team/ionic-docs#4705 ·
-
content package: angular
Difficulty 2/5 Half a day Newbie friendliness 78/100
ionic-team/ionic-docs#4702 ·
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 80/100
ionic-team/ionic-docs#4546 ·
-
content: broken link Opencontent
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ionic-team/ionic-docs#4381 · 2 comments ·
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 72/100
ionic-team/ionic-docs#3639 ·
All issues in ionic-team/ionic-docs
Similar issues
-
Browser Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
getsentry/sentry-javascript#24577 · 1 comment ·
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·
-
light
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
aemdemos/patients-stryker#253 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
clerk/javascript#9852 ·
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
amponce/archive-movie-browser#165 ·