0

In an Angular CLI project, when using an unsupported version of TypeScript you may get the following warning:

@angular/compiler-cli@6.1.0 requires typescript@'>=X.X.X <Y.Y.Y' but Z.Z.Z was found instead.
Using this version can result in undefined behaviour and difficult to debug problems.

It is possible to disable the TypeScript mismatch warning for the default project with the following command:

ng config cli.warnings.typescriptMismatch false

Now, when building an Angular library, ng-packagr throws this warning as an error, even with the typescriptMismatch setting set to false. Is it possible to temporarily disable this error? It is understood that this should not be done in a production environment, but it may be helpful when debugging issues that may be caused by TypeScript. The following StackOverflow question serves as an example use case.

Sam Herrmann
  • 6,293
  • 4
  • 31
  • 50

1 Answers1

5

You need to use disableTypeScriptVersionCheck under angularCompilerOptions In your tsconfig.

A. Agius
  • 1,211
  • 1
  • 14
  • 28
  • For anyone interested, I did not find this option in the [docs](https://angular.io/guide/aot-compiler#angular-compiler-options) but it is listed in [this source file](https://github.com/angular/angular/blob/6.1.x/packages/compiler-cli/src/transformers/api.ts#L137). – Sam Herrmann Aug 16 '18 at 17:45
  • @SamHerrmann I'd offer you a coffee (you need to come to Italy hahaha)! Thank you! – LppEdd Mar 11 '19 at 09:40
  • 1
    Just an update the [link](https://angular.io/guide/angular-compiler-options#disabletypescriptversioncheck) related to disableTypeScriptVersionCheck – David Yew Jun 22 '21 at 05:59