Type 'IterableIterator<[number, any]>' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators

I am using ionic 4 to build an app. Whereas my app is working fine on browser but when I build android platform it is giving me error for this line

for (let [index, p] of this.cart.entries())

The error is Type ‘IterableIterator<[number, any]>’ is not an array type or a string type. Use compiler option ‘–downlevelIteration’ to allow iterating of iterators.

My typescript version is 3.7.2
The app is working fine on browser but android platform is not getting build

Ionic (and Angular in general) are pretty sensitive about TypeScript versions. Any time you try manually upgrading, and encounter any problem, I would first downgrade TypeScript to the version that comes in with a brand-new Ionic project and see if the problem persists.

I solved it by adding “downlevelIteration”: true, in compilerOptions inside tsconfig.josn file. Note my target was es2015