Support Topics Documentation Slack YouTube Blog

typescript error with Ionic 3


(Carlos Mora) #1

I downloaded the Ionic project template, followed the instructions:

  • Copy this project directory

  • Install Ionic, cordova and node_modules

But when I try to use ionic serve or run the emulator I get TypeScript errors

I solved the initial problems installing the latest Typescript version (2.9.2) but then I got these new errors:

Typescript Error
Class ‘NavControllerBase’ incorrectly implements interface ‘NavController’. Types of property ‘popTo’ are incompatible. Type ‘(indexOrViewCtrl: any, opts?: NavOptions, done?: Function) => Promise’ is not assignable to type ‘(page: any, params?: any, opts?: NavOptions, done?: Function) => Promise’. Types of parameters ‘done’ and ‘opts’ are incompatible. Type ‘NavOptions’ is not assignable to type ‘Function’. Property ‘apply’ is missing in type ‘NavOptions’.

and

Typescript Error
Class ‘Subject<T>’ incorrectly extends base class ‘Observable<T>’. Types of property ‘lift’ are incompatible. Type ‘<T, R>(operator: Operator<T, R>) => Observable<T>’ is not assignable to type ‘<R>(operator: Operator<T, R>) => Observable<R>’. Type ‘Observable<T>’ is not assignable to type ‘Observable<R>’. Type ‘T’ is not assignable to type ‘R’.

Can you please help me?


(Stanislaw Grin) #2

Hi Carlos,

try to change version of typescript to 2.4.0 and version of rxjs to 5.0.0-beta.12. Then run npm i and npm start.
But this just a temporrary solution I can suggest you. Lately this project template will be fixed to use all latest versions of dependencies.


(Carlos Mora) #3

Excellent!! That made the trick :smiley: