问题
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.
回答1:
You need to use disableTypeScriptVersionCheck
under angularCompilerOptions
In your tsconfig.
来源:https://stackoverflow.com/questions/51861942/disable-typescript-mismatch-in-ng-packagr