不完全禁用每个文件的严格模板

问题描述 投票:0回答:1

我有一个包含很多文件的大项目。

现在我想用

strictTemplates
,所以我在里面添加了如下几行:

tsconfig.json

    ...
        "angularCompilerOptions": { 
        "fullTemplateTypeCheck": true, 
        "strictTemplates": true 
    ... 

现在我想禁用(或覆盖)某些

strictTemplates
文件的
html-template
规则。最好直接在文件中。

类似的东西:

component.html

// pseudo code
<!-- @ignore-strictTemplate -->

有办法做到这一点吗?

ThisAngular 指南页面 对我一点帮助都没有。

angular tslint tsconfig
1个回答
0
投票

According to angular documentation 您可以在某些上下文中使用 $any() 类型转换函数来选择不对表达式的一部分进行类型检查。

© www.soinside.com 2019 - 2024. All rights reserved.