angular-cn/packages
Keen Yee Liau 81241af7ac fix(language-service): Suggest ? and ! operator on nullable receiver (#35200)
Under strict mode, the language service fails to typecheck nullable
symbols that have already been verified to be non-null.

This generates incorrect (false positive) and confusing diagnostics
for users.

To work around this issue in the short term, this commit changes the
diagnostic message from an error to a suggestion, and prompts users to
use the safe navigation operator (?) or non-null assertion operator (!).

For example, instead of

```typescript
{{ optional && optional.toString() }}
```

the following is cleaner:

```typescript
{{ optional?.toString() }}
{{ optional!.toString() }}
```

Note that with this change, users who legitimately make a typo in their
code will no longer see an error. I think this is acceptable, since
false positive is worse than false negative. However, if users follow
the suggestion, add ? or ! to their code, then the error will be surfaced.
This seems a reasonable trade-off.

References:

1. Safe navigation operator (?)
   https://angular.io/guide/template-syntax#the-safe-navigation-operator----and-null-property-paths
2. Non-null assertion operator (!)
   https://angular.io/guide/template-syntax#the-non-null-assertion-operator---

PR closes https://github.com/angular/angular/pull/35070
PR closes https://github.com/angular/vscode-ng-language-service/issues/589

PR Close #35200
2020-02-10 16:43:44 -08:00
..
animations test: setup circular dependency tests for all entry points (#34774) 2020-01-23 11:36:40 -08:00
bazel fix(bazel): spawn prod server using port 4200 (#35160) 2020-02-06 15:35:11 -08:00
benchpress 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
common test(common): unit test for http/testing expectOne with several requests (#27005) 2020-01-31 13:13:38 -08:00
compiler fix(compiler): report errors for missing binding names (#34595) 2020-02-10 16:29:32 -08:00
compiler-cli test(ngcc): add missing `UmdReflectionHost#getExportsOfModule()` tests (#35312) 2020-02-10 16:13:41 -08:00
core fix(ivy): set namespace for host elements of dynamically created components (#35136) 2020-02-07 17:22:53 -08:00
docs refactor(core): remove deprecated Renderer (#33019) 2019-10-08 09:23:00 -07:00
elements test: setup circular dependency tests for all entry points (#34774) 2020-01-23 11:36:40 -08:00
examples docs: changes AoT to AOT for consistency (#35112) 2020-02-04 10:43:33 -08:00
forms docs: added description for `novalidate` form attribute. (#35166) 2020-02-10 16:11:58 -08:00
http refactor(http): fix a strictBindCallApply issue. (#34817) 2020-01-21 16:44:40 -05:00
language-service fix(language-service): Suggest ? and ! operator on nullable receiver (#35200) 2020-02-10 16:43:44 -08:00
localize build(localize): sync up babel dependencies (#35008) 2020-01-29 09:24:08 -08:00
platform-browser fix(ivy): set namespace for host elements of dynamically created components (#35136) 2020-02-07 17:22:53 -08:00
platform-browser-dynamic refactor(core): order private exports alphabetically (#35003) 2020-01-28 15:57:57 -08:00
platform-server fix(ivy): set namespace for host elements of dynamically created components (#35136) 2020-02-07 17:22:53 -08:00
platform-webworker 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
platform-webworker-dynamic build: set up all packages to publish via wombot proxy (#33747) 2019-11-13 11:34:33 -08:00
private/testing build: migrate determining if Ivy is enabled in typescript genrule files to use angular_ivy_enabled (#33983) 2019-11-26 16:38:40 -05:00
router test: setup circular dependency tests for all entry points (#34774) 2020-01-23 11:36:40 -08:00
service-worker test: setup circular dependency tests for all entry points (#34774) 2020-01-23 11:36:40 -08:00
upgrade docs: changes AoT to AOT for consistency (#35112) 2020-02-04 10:43:33 -08:00
zone.js feat: make jasmine patch as zone module (#34676) 2020-02-10 16:23:47 -08:00
BUILD.bazel build: reference zone.js from source directly instead of npm. (#33046) 2019-11-06 00:48:34 +00:00
README.md docs: add doc reference to npm package readme (#33911) 2019-11-20 14:46:23 -08:00
empty.ts
goog.d.ts fix(ivy): use goog.LOCALE for Closure Compiler to define default LOCALE_ID (#31519) 2019-07-16 13:02:10 -04:00
license-banner.txt build: bump year (#34651) 2020-01-13 07:21:43 -08:00
system.d.ts
tsconfig-build-no-strict.json refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
tsconfig-build.json refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
tsconfig-test.json refactor: fix typescript strict flag failures in all tests (#30993) 2019-07-18 14:21:26 -07:00
tsconfig.json build: consolidate @angular-devkit/build-angular to the root package.json (#34002) 2019-12-02 10:49:12 -08:00
types.d.ts build: reference zone.js from source directly instead of npm. (#33046) 2019-11-06 00:48:34 +00:00

README.md

Angular

The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.

Usage information and reference details can be found in Angular documentation.

License: MIT