Repository navigation
Description
Ionic version: (check one with "x")
[ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[x] 3.x
I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
App does not compile with TypeScript 2.4.x since
typescript: ...ments/GitHub/Helvar/AA-mobile/node_modules/ionic-angular/components/nav/nav.d.ts, line: 47
Class 'Nav' incorrectly extends base class 'NavControllerBase'. Types of property 'goToRoot' are
incompatible. Type '(opts: NavOptions) => Promise<any>' is not assignable to type '(opts: NavOptions) =>
Promise<never>'. Type 'Promise<any>' is not assignable to type 'Promise<never>'. Type 'any' is not
assignable to type 'never'.
L47: export declare class Nav extends NavControllerBase implements AfterViewInit, RootNode, INav {
L48: private _root;
[18:44:08] typescript: ...ents/GitHub/Helvar/AA-mobile/node_modules/ionic-angular/components/tabs/tab.d.ts, line: 121
Class 'Tab' incorrectly extends base class 'NavControllerBase'. Types of property 'goToRoot' are
incompatible. Type '(opts: NavOptions) => Promise<any>' is not assignable to type '(opts: NavOptions) =>
Promise<never>'. Type 'Promise<any>' is not assignable to type 'Promise<never>'.
L121: export declare class Tab extends NavControllerBase implements ITab {
L122: private _cd;
Expected behavior:
Steps to reproduce:
Related code:
insert any relevant code here
Other information:
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
insert the output from ionic info here
Activity
RoopeHakulinen commentedon Jul 2, 2017
This is caused by
Promise.rejectreturned from NavControllerBase's method goToRoot. I'll take a look at fix and possibly submit a PR.RoopeHakulinen commentedon Jul 2, 2017
PR #12235 fixes this by explicitly typing the promise.
jgw96 commentedon Jul 3, 2017
Hello @RoopeHakulinen , thanks for using Ionic and thanks for the PR! We will look into getting this merged.
vascofernandes commentedon Jul 4, 2017
add this to tsconfig.json temporarily until the issue is fixed:
ssalasgx commentedon Jul 7, 2017
Hi, i suddenly had a problem like that, and i didn't know why, i will share the screen


I checked ionic info:
And i try the solution from vascofernandes and it works, please can you explain how does it work?
Best regards!
RoopeHakulinen commentedon Jul 7, 2017
It works because in TS 2.4 there was an addition to the compiler that improves generics checking. In this case it relates to checking the generic
Promise<T>better. The problem is that the base class' (NavControllerBase) method returnsPromise<never>while the child class' (NavController) overrides this method and returnsPromise<any>. These two types are different starting from TS 2.4 and thus the compilation error.fiznool commentedon Jul 10, 2017
Would love to see this PR merged soon! tslint is causing a load of erroneous warnings with ts 2.3.4 due to this issue.
mburger81 commentedon Oct 2, 2017
@RoopeHakulinen is it save to use TS 2.4.2 on [email protected], we have som libs which requires >2.4 but I saw ionic is for example reverting TS from 2.5.x back again to 2.3.4 so it seems > 2.3.4 should not work properly?
RoopeHakulinen commentedon Oct 2, 2017
I haven't had a chance to update yet myself so unfortunately can't tell you that :( @jgw96 probably knows
nour05 commentedon Mar 20, 2018
it still does not work for me what I have to do!!
ionitron-bot commentedon Sep 1, 2018
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.