feat(ivy): add flag to disable checking of text attributes (#33365)

For elements that have a text attribute, it may happen that the element
is matched by a directive that consumes the attribute as an input. In
that case, the template type checker will validate the correctness of
the attribute with respect to the directive's declared type of the
input, which would typically be `boolean` for the `disabled` input.
Since empty attributes are assigned the empty string at runtime, the
template type checker would report an error for this template.

This commit introduces a strictness flag to help alleviate this
particular situation, effectively ignoring text attributes that happen
to be consumed by a directive.

PR Close #33365
This commit is contained in:
JoostK
2019-10-19 22:16:03 +02:00
committed by Andrew Kushnir
parent 4aa51b751b
commit d8ce2129d5
6 changed files with 69 additions and 0 deletions

View File

@ -431,6 +431,7 @@ export class NgtscProgram implements api.Program {
checkTemplateBodies: true,
checkTypeOfInputBindings: true,
strictNullInputBindings: true,
checkTypeOfAttributes: true,
// Even in full template type-checking mode, DOM binding checks are not quite ready yet.
checkTypeOfDomBindings: false,
checkTypeOfOutputEvents: true,
@ -451,6 +452,7 @@ export class NgtscProgram implements api.Program {
checkTemplateBodies: false,
checkTypeOfInputBindings: false,
strictNullInputBindings: false,
checkTypeOfAttributes: false,
checkTypeOfDomBindings: false,
checkTypeOfOutputEvents: false,
checkTypeOfAnimationEvents: false,