在 ng-packagr 中禁用 TypeScript 不匹配 [英] Disable TypeScript mismatch in ng-packagr

查看:16
本文介绍了在 ng-packagr 中禁用 TypeScript 不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 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 库时,ng-packagr 会将此警告作为错误抛出,即使 typescriptMismatch 设置为 false.是否可以暂时禁用此错误?据了解,这不应该在生产环境中进行,但在调试可能由 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.

推荐答案

您需要在 angularCompilerOptions 下使用 disableTypeScriptVersionCheck 在您的 tsconfig.

You need to use disableTypeScriptVersionCheck under angularCompilerOptions In your tsconfig.

这篇关于在 ng-packagr 中禁用 TypeScript 不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆