-
Notifications
You must be signed in to change notification settings - Fork 25.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ivy): strictness flags for template type checking #33273
Conversation
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
ea61718
to
2ed0d51
Compare
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly comments about changing defaults to false even with TTC on.
In View Engine, with fullTemplateTypeCheck mode disabled, the type of any inferred based on the entity being referenced. This is a bug, since the goal with fullTemplateTypeCheck: false is for Ivy and VE to be aligned in terms of type inference. This commit adds a 'checkTypeOfReference' flag in the TypeCheckingConfig to control this inference, and sets it to false when fullTemplateTypeCheck is disabled.
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.
The template type checking abilities of the Ivy compiler are far more advanced than the level of template type checking that was previously done for Angular templates. Up until now, a single compiler option called "fullTemplateTypeCheck" was available to configure the level of template type checking. However, now that more advanced type checking is being done, new errors may surface that were previously not reported, in which case it may not be feasible to fix all new errors at once. Having only a single option to disable a large number of template type checking capabilities does not allow for incrementally addressing newly reported types of errors. As a solution, this commit introduces some new compiler options to be able to enable/disable certain kinds of template type checks on a fine-grained basis.
2ed0d51
to
274e8af
Compare
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
feat(ivy): strictness flags for template type checking
The template type checking abilities of the Ivy compiler are far more
advanced than the level of template type checking that was previously
done for Angular templates. Up until now, a single compiler option
called "fullTemplateTypeCheck" was available to configure the level
of template type checking. However, now that more advanced type checking
is being done, new errors may surface that were previously not reported,
in which case it may not be feasible to fix all new errors at once.
Having only a single option to disable a large number of template type
checking capabilities does not allow for incrementally addressing newly
reported types of errors. As a solution, this commit introduces some new
compiler options to be able to enable/disable certain kinds of template
type checks on a fine-grained basis.
feat(ivy): add flag to disable checking of empty attributes
For elements that have a static attribute without a value, which is
typically the case for attributes like
disabled
, it may happen thatthe 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 thedisabled
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 empty attributes that happen
to be consumed by a directive.