Getting Error TS1005: '=' expected. - what does it mean?


#1

Been getting this error trying to import an angular d3 library. From what I’ve gathered so far, it’s a mismatch of Typescript versions? - https://www.npmjs.com/package/a2d3 -

Any other ideas as to what it could be? How to solve?


#2

Okay, have gotten a bit deeper in this.

The library is using Typescript 1.9 which compiles to readonly files when there is only a getter, and not a setter on the provider. It seems that the “ionic-gulp-browserify-typescript” compiles the Ionic project with Typescript 1.8.10, which does not support readonly?

Therefore throwing the type errors on all lines where there is a readonly in the library.


#3

If that’s the case, you could probably modify your package.json to get TypeScript 1.9 for your project, and Ionic should use that.


#4

IMHO it’s a pretty odd decision for a library to make a release based on a nightly build of TypeScript. There’s no official release of TypeScript 1.9 and judging by the progress on TypeScript 2.0 it might be the next release. I guess that you can also try using the same TypeScript version (as @rapropos suggested) or you can get a previous release of the d3 library based on official TypeScript release.