81241af7ac
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 |
||
---|---|---|
.. | ||
animations | ||
bazel | ||
benchpress | ||
common | ||
compiler | ||
compiler-cli | ||
core | ||
docs | ||
elements | ||
examples | ||
forms | ||
http | ||
language-service | ||
localize | ||
platform-browser | ||
platform-browser-dynamic | ||
platform-server | ||
platform-webworker | ||
platform-webworker-dynamic | ||
private/testing | ||
router | ||
service-worker | ||
upgrade | ||
zone.js | ||
BUILD.bazel | ||
README.md | ||
empty.ts | ||
goog.d.ts | ||
license-banner.txt | ||
system.d.ts | ||
tsconfig-build-no-strict.json | ||
tsconfig-build.json | ||
tsconfig-test.json | ||
tsconfig.json | ||
types.d.ts |
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