とんかつ時々あんどーなつ

〜たとえ低空でも飛行していられるように〜

TypeScript 2.8 系以上で Angular AOT Compiler が失敗する

Angular CLI を v6.0.x 系で TypeScript を v2.8 以上にしてビルドを実行すると以下のエラーが出て、失敗する

ERROR in The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 2.9.1 was found instead.

現時点では Angular AOT Compiler v6.0.x は TypeScript 2.7.x しかサポートしておらず、それ以上のバージョンを使う場合は、アプリケーションの tsconfig(src/tsconfig.app.json) 内の angularCompilerOptions 内の disableTypeScriptVersionCheck オプションを使用してエラーを無効にする必要があるらしい

github.com

tsconfig.app.json を下記のように変更するとバージョンチェックを無視するようになる

   "exclude": [
     "src/test.ts",
     "**/*.spec.ts"
-  ]
+  ],
+  "angularCompilerOptions": {
+    "disableTypeScriptVersionCheck": true
+  }
 }