angular-cn/packages/platform-browser-dynamic/src
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
..
resource_loader refactor(platform-browser): compiler platform-browser packages cleanly (#18464) 2017-08-02 16:30:50 -07:00
compiler_factory.ts feat(platform-browser-dynamic): export `JitCompilerFactory` (#20478) 2017-11-22 08:56:11 -06:00
compiler_reflector.ts feat(compiler): narrow types of expressions used in *ngIf (#20702) 2017-12-08 10:24:26 -08:00
platform-browser-dynamic.ts feat(platform-browser-dynamic): export `JitCompilerFactory` (#20478) 2017-11-22 08:56:11 -06:00
platform_core_dynamic.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
platform_providers.ts perf: switch angular to use StaticInjector instead of ReflectiveInjector 2017-08-07 15:42:34 -07:00
private_export.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
version.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00