angular/packages/core/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
..
animation feat(animations): introduce a wave of new animation features 2017-05-16 17:39:57 -07:00
change_detection docs: fix link texts 2017-11-01 15:44:59 -04:00
debug build: update npm dependencies (#19328) 2017-09-22 13:20:52 -07:00
di refactor(core): Removed readonly getters and changed to readonly (#19842) 2017-12-08 10:24:19 -08:00
i18n docs(core): add docs for i18n tokens (#17920) 2017-12-05 21:56:43 -08:00
linker refactor(core): Removed readonly getters and changed to readonly (#19842) 2017-12-08 10:24:19 -08:00
metadata docs: fix link texts 2017-11-01 15:44:59 -04:00
profile fix(core): Update types for TypeScript nullability support (#15472) 2017-03-29 09:34:45 -07:00
reflection feat(compiler): narrow types of expressions used in *ngIf (#20702) 2017-12-08 10:24:26 -08:00
render docs: fix link texts 2017-11-01 15:44:59 -04:00
testability fix(upgrade): add testability hook to downgraded component 2017-09-12 16:59:27 -04:00
util refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
view refactor(core): Removed readonly getters and changed to readonly (#19842) 2017-12-08 10:24:19 -08:00
zone build: upgrade bazel rules to latest (#20768) 2017-12-07 11:27:50 -08:00
application_init.ts refactor(core): removed getter and changed to readonly variable (#19117) 2017-09-20 12:38:57 -07:00
application_module.ts refactor: core, http & platform-webworker to remove public private class separation (#19143) 2017-09-14 13:38:06 -04:00
application_ref.ts revert: feat(core): add source to StaticInjectorError message (#19482) (#20171) 2017-11-03 14:51:06 -07:00
application_tokens.ts docs: fix link texts 2017-11-01 15:44:59 -04:00
change_detection.ts refactor(core): remove deprecated TrackByFn (#18757) 2017-08-18 13:23:46 -05:00
codegen_private_exports.ts refactor(compiler): don’t rely on global reflector (#16832) 2017-05-23 10:41:23 -06:00
console.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
core.externs.js fix: don’t use the global ng at all with closure enhanced optimizations 2017-09-27 10:09:56 -07:00
core.ts perf(core): Remove decorator DSL which depends on Reflect 2017-08-11 09:27:07 -07:00
core_private_export.ts feat(compiler): introduce TestBed.overrideTemplateUsingTestingModule 2017-11-06 14:12:30 -08:00
di.ts refactor(core): remove deprecated OpaqueToken (#18971) 2017-09-01 16:29:47 -05:00
error_handler.ts refactor(core): remove deprecated parameter for ErrorHandler (#18759) 2017-08-17 18:01:41 -05:00
errors.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
event_emitter.ts docs(core): EventEmitter docs for isAsync defaults (#15780) 2017-05-08 10:47:53 -07:00
linker.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
metadata.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
platform_core_providers.ts refactor: core, http & platform-webworker to remove public private class separation (#19143) 2017-09-14 13:38:06 -04:00
render.ts refactor(core): use flags in Renderer2.setStyle instead of booleans (#15045) 2017-03-13 09:45:04 -07:00
security.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
type.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
util.ts fix: create proper externs so that closure does not clobber e.g. ng for internal variables (#19423) 2017-09-26 15:02:33 -07:00
version.ts refactor(core): removed getter and changed to readonly variable (#19117) 2017-09-20 12:38:57 -07:00
zone.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00