eb6975acaf
The Ivy template type-checker is capable of inferring the type of a structural directive (such as NgForOf<T>). Previously, this was done with fullTemplateTypeCheck: true, even if strictTemplates was false. View Engine previously did not do this inference, and so this causes breakages if the type of the template context is not what the user expected. In particular, consider the template: ```html <div *ngFor="let user of users as all"> {{user.index}} out of {{all.length}} </div> ``` As long as `users` is an array, this seems reasonable, because it appears that `all` is an alias for the `users` array. However, this is misleading. In reality, `NgForOf` is rendered with a template context that contains both a `$implicit` value (for the loop variable `user`) as well as a `ngForOf` value, which is the actual value assigned to `all`. The type of `NgForOf`'s template context is `NgForContext<T>`, which declares `ngForOf`'s type to be `NgIterable<T>`, which does not have a `length` property (due to its incorporation of the `Iterable` type). This commit stops the template type-checker from inferring template context types unless strictTemplates is set (and strictInputTypes is not disabled). Fixes #33527. PR Close #33537 |
||
---|---|---|
.circleci | ||
.devcontainer | ||
.github | ||
.vscode | ||
aio | ||
docs | ||
integration | ||
modules | ||
packages | ||
scripts | ||
third_party | ||
tools | ||
.bazelignore | ||
.bazelrc | ||
.clang-format | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
.mailmap | ||
.nvmrc | ||
BUILD.bazel | ||
CHANGELOG.md | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md | ||
WORKSPACE | ||
browser-providers.conf.js | ||
gulpfile.js | ||
karma-js.conf.js | ||
package.json | ||
protractor-perf.conf.js | ||
renovate.json | ||
shims_for_IE.js | ||
test-events.js | ||
test-main.js | ||
tslint.json | ||
yarn.lock | ||
yarn.lock.readme.md |
README.md
Angular
Angular is a development platform for building mobile and desktop web applications using TypeScript/JavaScript and other languages.
Quickstart
Changelog
Learn about the latest improvements.
Want to help?
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues in the hotlist: community-help.