Skip to content

feat(angular): derive .observable() options from the installed HttpClient - #10

Merged
pkurcx merged 1 commit into
mainfrom
feat/derived-observable-options
Oct 6, 2026
Merged

pkurcx merged 1 commit into
mainfrom
feat/derived-observable-options

Conversation

@pkurcx

@pkurcx pkurcx commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

ObservableOptions in templates/angular/rest.model.ts was a hand-kept list, so it fell behind Angular. On Angular 22 .observable() rejected integrity, referrer, referrerPolicy, reportUploadProgress and reportDownloadProgress, and reportProgress lost its @deprecated marker.

It is now derived from the consumer's own HttpClient:

export type ObservableOptions = Omit<
  NonNullable<Parameters<HttpClient['request']>[2]>,
  'body' | 'params' | 'headers' | 'responseType'
> & { injector?: Injector };

Parameters reads request()'s last overload, its catch-all. Options a later Angular adds therefore pass through without a release or a regeneration. The runtime already spread every option into HttpClient.request, so only the type changes.

  • Proof (service-proof.ts): compares the option keys against HttpClient's, because a non-literal argument skips excess-property checks. It also calls .observable() with the five new options, and keeps @ts-expect-error checks for the four keys the operation supplies. Before the fix, the key check failed and named exactly the five missing options.
  • Docs and README: the options paragraph now says the options come from the installed Angular. Examples use reportUploadProgress / reportDownloadProgress instead of the deprecated reportProgress.

Test plan

  • bun run test: 400 passed
  • cargo test: 325 passed
  • bun run typecheck, bun run lint
  • bun run regen-snapshots: only static-template/rest.model.ts changed
  • Generated client plus the key and option checks compile on Angular 20.3 (TS 5.8) and 21.2 (TS 5.9), checked by hand since the suite gates 22
  • Editor completions mark reportProgress deprecated on .observable(), the same as on HttpClient.request

After release: regenerate stackblitz/src/generated, which still carries the hand-kept list from 0.7.0.

🤖 Generated with Claude Code

…ient

`ObservableOptions` was a hand-kept list, so it lagged Angular: on 22 it
rejected `integrity`, `referrer`, `referrerPolicy`, `reportUploadProgress`
and `reportDownloadProgress`, and dropped the `@deprecated` tag on
`reportProgress`. It is now the catch-all `HttpClient.request` options of
the consumer's Angular minus body/params/headers/responseType, plus
`injector`, so options a later Angular adds pass through without a
release or a regeneration.

The service proof checks the option keys against HttpClient's, since a
non-literal argument skips excess-property checks, and still rejects the
four keys the operation supplies. Verified by hand on Angular 20.3 and
21.2; the suite gates 22.
@pkurcx
pkurcx merged commit 3ca88a6 into main Oct 6, 2026
38 checks passed
@pkurcx
pkurcx deleted the feat/derived-observable-options branch October 6, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant