angular-cn/packages/compiler-cli/test
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
..
compliance fix(ivy): incorrectly generating shared pure function between null and object literal (#35481) 2020-02-20 15:23:58 -08:00
diagnostics build: derive ts_library dep from jasmine_node_test boostrap label if it ends in `_es5` (#34736) 2020-01-15 14:58:07 -05:00
helpers fix(ivy): handle namespaced imports correctly (#31367) 2019-07-09 09:40:30 -07:00
metadata build: derive ts_library dep from jasmine_node_test boostrap label if it ends in `_es5` (#34736) 2020-01-15 14:58:07 -05:00
ngtsc fix(ivy): narrow `NgIf` context variables in template type checker (#35125) 2020-02-28 07:39:57 -08:00
transformers build: derive ts_library dep from jasmine_node_test boostrap label if it ends in `_es5` (#34736) 2020-01-15 14:58:07 -05:00
BUILD.bazel build: derive ts_library dep from jasmine_node_test boostrap label if it ends in `_es5` (#34736) 2020-01-15 14:58:07 -05:00
extract_i18n_spec.ts feat: make the Ivy compiler the default for ngc (#32219) 2019-08-20 16:41:08 -07:00
mocks.ts fix(compiler-cli): Use typescript to resolve modules for metadata (#22856) 2018-07-10 11:11:48 -07:00
ngc_spec.ts fix(compiler): switch to modern diagnostic formatting (#34234) 2019-12-09 11:37:49 -08:00
perform_compile_spec.ts fix(compiler): return enableIvy true when using `readConfiguration` (#32234) 2019-08-21 10:06:25 -07:00
perform_watch_spec.ts fix(ivy): recompile on template change in ngc watch mode on Windows (#34015) 2020-02-04 10:40:22 -08:00
test_support.ts fix(compiler): switch to modern diagnostic formatting (#34234) 2019-12-09 11:37:49 -08:00
typescript_support_spec.ts feat(ivy): verify whether TypeScript version is supported (#33377) 2019-10-24 15:46:23 -07:00