angular/packages/compiler-cli/test
Chuck Jazdzewski e7d9cb3e4c feat(compiler): narrow types of expressions used in *ngIf (#20702)
Structural directives can now specify a type guard that describes
what types can be inferred for an input expression inside the
directive's template.

NgIf was modified to declare an input guard on ngIf.

After this change, `fullTemplateTypeCheck` will infer that
usage of `ngIf` expression inside it's template is truthy.

For example, if a component has a property `person?: Person`
and a template of `<div *ngIf="person"> {{person.name}} </div>`
the compiler will no longer report that `person` might be null or
undefined.

The template compiler will generate code similar to,

```
  if (NgIf.ngIfTypeGuard(instance.person)) {
    instance.person.name
  }
```

to validate the template's use of the interpolation expression.
Calling the type guard in this fashion allows TypeScript to infer
that `person` is non-null.

Fixes: #19756?

PR Close #20702
2017-12-08 10:24:26 -08:00
..
diagnostics feat(compiler): narrow types of expressions used in *ngIf (#20702) 2017-12-08 10:24:26 -08:00
metadata feat(compiler): narrow types of expressions used in *ngIf (#20702) 2017-12-08 10:24:26 -08:00
transformers fix(compiler-cli): Fix swallowed Error messages (#20846) 2017-12-06 16:49:22 -08:00
extract_i18n_spec.ts refactor(compiler): remove all source-level traces to tsc-wrapped (#18966) 2017-09-13 20:47:37 -04:00
mocks.ts refactor(compiler): remove old ngtools api and add listLazyRoutes to new api (#19836) 2017-10-23 18:46:04 -04:00
ngc_spec.ts ci: upgrade to node 8 and Bazel 0.8 (#20807) 2017-12-06 06:58:33 -08:00
ngtools_api_spec.ts refactor(compiler): remove old ngtools api and add listLazyRoutes to new api (#19836) 2017-10-23 18:46:04 -04:00
perform_watch_spec.ts feat(compiler-cli): improve error messages produced during structural errors (#20459) 2017-11-27 16:59:57 -06:00
test_support.ts fix(compiler): recover from structural errors in watch mode (#19953) 2017-10-26 18:43:00 -04:00