angular/packages/common/http/test
JoostK 50d9d55f49 fix(core): fix narrowing of Resource.hasValue() (#63994)
This commit changes `Resource.hasValue()` and its derived types to improve narrowing
of resources whose generic type either does not include `undefined` (i.e. when a default
value has been provided) or when the generic type is `unknown`. This fixes the undesirable
behavior where `hasValue()` would cause the `else` branch of an `hasValue()` conditional
to have a narrowed type of `never`, given that the `hasValue()`'s type guard covers the
entire type range already (meaning that the type in the else-branch cannot be inhabited
in the type system, yielding the `never` type).

By making the `hasValue()` method only a type guard when the generic type includes `undefined`
these problems are avoided.

Fixes #60766
Fixes #63545
Fixes #63982

PR Close #63994
2025-09-23 14:20:55 +00:00
..
BUILD.bazel refactor: remove TODOs which have been corrected (#63421) 2025-08-27 11:23:57 -07:00
client_spec.ts fix(http): add missing http options allowed in fetch API (#62881) 2025-07-30 14:07:41 +00:00
context_spec.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
fetch_spec.ts refactor(common): drop X-Request-URL (#61943) 2025-08-25 08:45:19 -07:00
headers_spec.ts refactor(common): convert scripts within packages/common to relative imports (#60623) 2025-04-01 15:58:51 +00:00
jsonp_mock.ts refactor(core): remove TODOs referencing #24571 (#60648) 2025-03-31 20:24:29 +00:00
jsonp_spec.ts refactor(common): convert scripts within packages/common to relative imports (#60623) 2025-04-01 15:58:51 +00:00
module_spec.ts refactor(common): convert scripts within packages/common to relative imports (#60623) 2025-04-01 15:58:51 +00:00
params_spec.ts refactor(common): convert scripts within packages/common to relative imports (#60623) 2025-04-01 15:58:51 +00:00
provider_spec.ts feat(http): Provide http services in root (#56212) 2025-08-14 13:04:35 +02:00
request_spec.ts feat(http): Add support for fetch referrer & integrity options in HttpClient (#62417) 2025-07-03 08:07:36 +00:00
resource_spec.ts fix(core): fix narrowing of Resource.hasValue() (#63994) 2025-09-23 14:20:55 +00:00
response_spec.ts feat(http): Add reponseType property to HttpResponse and HttpErrorResponse (#63043) 2025-08-28 08:34:56 -07:00
transfer_cache_spec.ts refactor: remove TODOs which have been corrected (#63421) 2025-08-27 11:23:57 -07:00
xhr_mock.ts feat(http): Add timeout option to HTTP requests (#57194) 2025-06-27 09:56:25 +00:00
xhr_spec.ts refactor(common): drop X-Request-URL (#61943) 2025-08-25 08:45:19 -07:00
xsrf_spec.ts refactor(common): drop platform checks in HttpXsrfCookieExtractor (#59810) 2025-05-01 08:41:10 -07:00