angular-cn/tools/public_api_guard
JoostK 40039d8068 fix(ivy): narrow `NgIf` context variables in template type checker (#35125)
When the `NgIf` directive is used in a template, its context variables
can be used to capture the bound value. This is typically used together
with a pipe or function call, where the resulting value is captured in a
context variable. There's two syntax forms available:

1. Binding to `NgIfContext.ngIf` using the `as` syntax:
```html
<span *ngIf="(user$ | async) as user">{{user.name}}</span>
```

2. Binding to `NgIfContext.$implicit` using the `let` syntax:
```html
<span *ngIf="user$ | async; let user">{{user.name}}</span>
```

Because of the semantics of `ngIf`, it is known that the captured
context variable is non-nullable, however the template type checker
would not consider them as such and still report errors when
`strictNullTypes` is enabled.

This commit updates `NgIf`'s context guard to make the types of the
context variables non-nullable, avoiding the issue.

Fixes #34572

PR Close #35125
2020-02-28 07:39:57 -08:00
..
animations docs: update animations to use `@publicApi` tags (#26595) 2018-10-19 14:35:53 -07:00
common fix(ivy): narrow `NgIf` context variables in template type checker (#35125) 2020-02-28 07:39:57 -08:00
core feat: add an tickOptions parameter with property processNewMacroTasksSynchronously. (#33838) 2020-02-20 15:14:59 -08:00
elements docs: update elements to use `@publicApi` tags (#26595) 2018-10-19 14:35:53 -07:00
forms build: update API Golden files after node 12 update (#34955) 2020-01-27 09:31:22 -08:00
http build: update API Golden files after node 12 update (#34955) 2020-01-27 09:31:22 -08:00
localize fix(ivy): i18n - use `MessageId` for matching translations (#32594) 2019-09-17 09:17:44 -07:00
platform-browser feat(ivy): make Hammer support tree-shakable (#32203) 2019-08-21 11:43:51 -07:00
platform-browser-dynamic docs: update platform-browser-dynamic to use `@publicApi` tags (#26595) 2018-10-19 14:35:53 -07:00
platform-server build: typescript 3.7 support (#33717) 2020-01-14 16:42:21 -08:00
platform-webworker docs(platform-webworker): mark all public APIs as deprecated (#33824) 2019-11-15 16:14:37 -08:00
platform-webworker-dynamic feat(platform-webworker): deprecate platform-webworker (#30642) 2019-05-23 15:09:48 -07:00
router build: typescript 3.7 support (#33717) 2020-01-14 16:42:21 -08:00
service-worker build: typescript 3.7 support (#33717) 2020-01-14 16:42:21 -08:00
upgrade feat(upgrade): provide unit test helpers for wiring up injectors (#16848) 2019-06-20 17:04:01 -07:00
BUILD.bazel refactor(compiler): rename diagnostics/src/code.ts to diagnostics/src/error_code.ts (#35067) 2020-01-31 11:25:27 -08:00
error_code.d.ts test: add the error code of ngc/ngtsc under api guard (#35067) 2020-01-31 11:25:27 -08:00
global_utils.d.ts refactor(ivy): remove markDirty from global utilities (#34453) 2020-01-30 11:30:32 -08:00
public_api_guard.bzl build(ivy): remove the remains of ivy-jit mode (#27278) 2018-11-27 10:30:58 -08:00