angular-cn/tools/public_api_guard
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
..
animations feat(animations): re-introduce support for transition matching functions (#20723) 2017-12-07 17:16:09 -08:00
common feat(compiler): narrow types of expressions used in *ngIf (#20702) 2017-12-08 10:24:26 -08:00
compiler build: update public api file names (#19190) 2017-09-19 16:59:18 -07:00
core refactor(core): misc changes and integrate review feedback on #19996 2017-11-06 14:13:02 -08:00
forms feat(forms): allow nulls on setAsyncValidators (#20327) 2017-12-07 13:34:12 -08:00
http build: update public api file names (#19190) 2017-09-19 16:59:18 -07:00
platform-browser feat(platform-server): add an API to transfer state from server (#19134) 2017-09-21 13:56:13 -07:00
platform-browser-dynamic feat(platform-browser-dynamic): export `JitCompilerFactory` (#20478) 2017-11-22 08:56:11 -06:00
platform-server feat(platform-server): add an API to transfer state from server (#19134) 2017-09-21 13:56:13 -07:00
platform-webworker fix: Update test code to type-check under TS 2.5 (#20175) 2017-11-15 18:12:16 -06:00
platform-webworker-dynamic build: update public api file names (#19190) 2017-09-19 16:59:18 -07:00
router feat(router): add "onSameUrlNavigation" router configuration option (#19463) 2017-10-23 20:56:53 -04:00
service-worker fix(service-worker): don't crash if SW not supported 2017-12-01 14:18:16 -08:00
upgrade build: update public api file names (#19190) 2017-09-19 16:59:18 -07:00