Recently, I updated my application to use the latest versions of Angular 2 rc.6
and Angular Material 2 alpha 8-1
. These updates require typescript 2
, with the latter introducing the new readonly
modifier.
To compile my .ts files, I rely on gulp-typescript
, but since the package uses typescript 1.8.10
, I am now encountering errors related to the readonly
modifier. For example, this line:
readonly change: Observable<MdButtonToggleChange>;
Produces these compilation errors:
error TS1005: '=' expected.
error TS1005: ';' expected.
error TS1005: '(' expected.
It seems that the issue lies in the fact that gulp-typescript
is not compatible with the new readonly
modifier introduced in typescript 2
.
Interestingly, none of my own code utilizes readonly
; the errors are occurring solely in third-party typescript definition files (.d.ts
) from the Angular 2 Material
packages located within my node_modules/
folder. Despite attempting to exclude them in the tsconfig.json
file like so:
"exclude": [
"node_modules",
"typings"
]
The errors persist.
- Is there a solution to this problem?
- If not, is there an alternative method to prevent the compiler from checking
.d.ts
files?