Skip to content

fix(core): derive possible null value in rxResource stream params#68167

Closed
surajy93 wants to merge 1 commit intoangular:mainfrom
surajy93:fix-rxresource-params-type
Closed

fix(core): derive possible null value in rxResource stream params#68167
surajy93 wants to merge 1 commit intoangular:mainfrom
surajy93:fix-rxresource-params-type

Conversation

@surajy93
Copy link
Copy Markdown

When an optional params function returns undefined, Angular's rxResource internally defaults the params loader value to null at runtime. This change updates ResourceLoaderParams<R> to correctly allow null alongside the resolved type, ensuring developers get accurate TypeScript feedback when omitted.

Fixes #62724

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

When the params option is not provided to rxResource or it evaluates to undefined, the type of the params argument in the internal stream function is restricted to the strictly inferred type (e.g. Params), even though it resolves to null at runtime.

Issue Number: #62724

What is the new behavior?

The type inference for ResourceLoaderParams<R> correctly derives a potential null value in instances where undefined could be inferred from the original params option payload. This correctly aligns the TypeScript expectations within stream or loader functions to match the runtime behavior.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

N/A

When an optional params function returns undefined, Angular's rxResource internally defaults the params loader value to null at runtime. This change updates `ResourceLoaderParams<R>` to correctly allow `null` alongside the resolved type, ensuring developers get accurate TypeScript feedback when omitted.

Fixes angular#62724
@google-cla
Copy link
Copy Markdown

google-cla bot commented Apr 13, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@pullapprove pullapprove bot requested a review from atscott April 13, 2026 14:05
@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Apr 13, 2026
@ngbot ngbot bot added this to the Backlog milestone Apr 13, 2026
@JeanMeche
Copy link
Copy Markdown
Member

Sorry, this doesn't pass the threshold of worty PR. This is obviously AI generated, wasn't tested because it doesn't work and is breaking.

@JeanMeche JeanMeche closed this Apr 13, 2026
@surajy93 surajy93 deleted the fix-rxresource-params-type branch April 13, 2026 14:19
surajy93 pushed a commit to surajy93/angular that referenced this pull request Apr 13, 2026
surajy93 pushed a commit to surajy93/angular that referenced this pull request Apr 13, 2026
surajy93 pushed a commit to surajy93/angular that referenced this pull request Apr 13, 2026
Align resource and rxResource typings with the runtime null sentinel when params are omitted or undefined.
surajy93 added a commit to surajy93/angular that referenced this pull request Apr 13, 2026
Align resource and rxResource typings with the runtime null sentinel when params are omitted or undefined.
surajy93 added a commit to surajy93/angular that referenced this pull request Apr 13, 2026
Align resource and rxResource typings with the runtime null sentinel when params are omitted or undefined.
surajy93 added a commit to surajy93/angular that referenced this pull request Apr 13, 2026
…gular#68167)

Align resource and rxResource typings with the runtime
behavior when params are missing or explicitly undefined.
surajy93 added a commit to surajy93/angular that referenced this pull request Apr 13, 2026
…r#68167)

Align resource and rxResource typings with the runtime null sentinel when params are omitted or explicitly undefined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Issues related to the framework runtime cla: no

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rxResource params field type in stream function doesn't derive possible null value

2 participants