1425e63029
Currently, variables of an unknown type in an `*ngFor` expression are refined to have the type of the iterable binding of the `*ngFor` expression. Unfortunately, this is a bug for variables aliasing [values exported by `*ngFor`](https://angular.io/api/common/NgForOf#local-variables), including `index` and `first`, because they are also given the type of the binding expression, but they are not of the binding type. For example, in ```typescript @Component({ selector: 'test', template: ` <div *ngFor="let hero of heroes; let i = index; let isFirst = first"> {{ hero }} </div> ` }) export class TestComponent { heroes: Hero[]; } ``` The local variables `i` and `isFirst` are determined to have a type of `Hero`, when actually their types are `number` and `boolean`, respectively. This commit fixes this bug by checking if the value of a variable in an `*ngFor` expression is known to be an export and assigning the variable the type of that export value. Only if the variable does not alias an export is it typed with the binding value of the `*ngFor` expression. Closes https://github.com/angular/vscode-ng-language-service/issues/460 PR Close #34089 |
||
---|---|---|
.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 | ||
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.