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
This is caused by Promise.reject
returned from _NavControllerBase_'s method _goToRoot_. I'll take a look at fix and possibly submit a PR.
PR #12235 fixes this by explicitly typing the promise.
Hello @RoopeHakulinen , thanks for using Ionic and thanks for the PR! We will look into getting this merged.
add this to tsconfig.json temporarily until the issue is fixed:
"compilerOptions": {
....
"skipLibCheck": true,
"noStrictGenericChecks": true,
.....
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!
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 returns Promise<never>
while the child class' (NavController
) overrides this method and returns Promise<any>
. These two types are different starting from TS 2.4 and thus the compilation error.
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.
@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?
I haven't had a chance to update yet myself so unfortunately can't tell you that :( @jgw96 probably knows
it still does not work for me what I have to do!!
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.
Most helpful comment
add this to tsconfig.json temporarily until the issue is fixed: