angular/packages/common/http/src
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
..
backend.ts feat(http): Provide http services in root (#56212) 2025-08-14 13:04:35 +02:00
client.ts feat(http): Provide http services in root (#56212) 2025-08-14 13:04:35 +02:00
context.ts docs: set syntax highlighting of code examples MD code blocks (#59026) 2024-12-04 17:30:28 +01:00
errors.ts docs: add documentation for NG02802 warning about HttpTransferCache headers (#63802) 2025-09-15 15:38:24 +00:00
fetch.ts feat(http): Add reponseType property to HttpResponse and HttpErrorResponse (#63043) 2025-08-28 08:34:56 -07:00
headers.ts refactor(core): remove TODOs referencing #24571 (#60648) 2025-03-31 20:24:29 +00:00
interceptor.ts refactor(core): protect InjectionToken usage of ngDevMode (#63875) 2025-09-19 21:27:45 +00:00
jsonp.ts refactor(common): convert scripts within packages/common to relative imports (#60623) 2025-04-01 15:58:51 +00:00
module.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
params.ts refactor(common): drop error message in production (#59471) 2025-01-15 12:28:29 -05:00
private_export.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
provider.ts refactor(core): protect InjectionToken usage of ngDevMode (#63875) 2025-09-19 21:27:45 +00:00
request.ts refactor(common): drop X-Request-URL (#61943) 2025-08-25 08:45:19 -07:00
resource.ts fix(http): Reset headers, progress, and statusCode when using set() in HttpResource (#62873) 2025-08-01 08:08:52 +00:00
resource_api.ts fix(core): fix narrowing of Resource.hasValue() (#63994) 2025-09-23 14:20:55 +00:00
response.ts feat(http): Add reponseType property to HttpResponse and HttpErrorResponse (#63043) 2025-08-28 08:34:56 -07:00
transfer_cache.ts refactor(core): protect InjectionToken usage of ngDevMode (#63875) 2025-09-19 21:27:45 +00:00
xhr.ts refactor(common): drop X-Request-URL (#61943) 2025-08-25 08:45:19 -07:00
xsrf.ts refactor(core): protect InjectionToken usage of ngDevMode (#63875) 2025-09-19 21:27:45 +00:00