禁用ng-packagr中的TypeScript不匹配 [英] Disable TypeScript mismatch in ng-packagr
问题描述
在Angular CLI项目中,使用不受支持的TypeScript版本时,您可能会收到以下警告:
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.
可以使用以下命令为默认项目禁用TypeScript不匹配警告:
It is possible to disable the TypeScript mismatch warning for the default project with the following command:
ng config cli.warnings.typescriptMismatch false
现在,在构建Angular库时,即使将typescriptMismatch
设置设置为false
,ng-packagr
也会将此警告抛出错误.是否可以暂时禁用此错误?应该理解,这不应该在生产环境中完成,但是在调试由TypeScript引起的问题时可能会有所帮助.以下 StackOverflow问题作为示例用例.
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.
推荐答案
您需要在tsconfig中的angularCompilerOptions
下使用disableTypeScriptVersionCheck
.
You need to use disableTypeScriptVersionCheck
under angularCompilerOptions
In your tsconfig.
这篇关于禁用ng-packagr中的TypeScript不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!