Skip to content

feat(cdk): improve RxStrategy typing and auto completion#1900

Open
ChristopherPHolder wants to merge 3 commits into
rx-angular:mainfrom
ChristopherPHolder:ch/improve-strategy-provider-strategy
Open

feat(cdk): improve RxStrategy typing and auto completion#1900
ChristopherPHolder wants to merge 3 commits into
rx-angular:mainfrom
ChristopherPHolder:ch/improve-strategy-provider-strategy

Conversation

@ChristopherPHolder

@ChristopherPHolder ChristopherPHolder commented Jan 17, 2026

Copy link
Copy Markdown
Contributor

Description

This MR improves the typing of the RxStrategyProvider by changing the type generics default parameter to the real default

Motivation

Allow for better auto-completion and type correctness as well as preventing typos.

Cases

1. Injected in constructor without generic

Before

Screenshot 2026-01-17 at 19 15 45 image

After

image image

2. Injected in constructor with generic

There is not behavior change here.

image image

3. Injected with inject without generic

There is not behavior change here.

image image

4. Injected with inject with generic

Before

After

image image image

Notes

It's important to consider the trade-off here; adding the real defaults will prevent typos but will force you to pass generics when you create custom strategies.

It's a question of if the user should have a default narrow type or wide type.

To me, this seems like a reasonable choice, especially since the use of custom strategies is very advanced, so the requirement of passing an additional generic to widen the type seems reasonable, as it's only for that "niche" case.

Additionally, due to the current issue with the typing of the inject function without passing a generic, it would also be reasonable to expo a wrapping function mainly used to fix the generic typing, but that seems to be passing any.
But to be honest, I have not investigated further as to why this is happening.

@github-actions github-actions Bot added the 🛠️ CDK CDK related label Jan 17, 2026
@nx-cloud

nx-cloud Bot commented Jan 17, 2026

Copy link
Copy Markdown

Nx Cloud AI Fix could not be generated

View fix generation details ↗


View your CI Pipeline Execution ↗ for commit 3cf2695

Command Status Duration Result
nx affected -t lint build test component-test e... ⛔ Cancelled 3h 11m 32s View ↗
nx build docs ✅ Succeeded 24s View ↗
nx-cloud record -- npx nx format:check ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-17 21:25:03 UTC

@ChristopherPHolder ChristopherPHolder marked this pull request as draft January 17, 2026 17:39
@ChristopherPHolder ChristopherPHolder marked this pull request as ready for review January 17, 2026 18:30
@hoebbelsB

Copy link
Copy Markdown
Member

Thanks @ChristopherPHolder .

We might need to consider this as a breaking change?

@ChristopherPHolder

ChristopherPHolder commented Jan 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @ChristopherPHolder .

We might need to consider this as a breaking change?

@hoebbelsB Seems like a breaking change, especially considering the build that fails now.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛠️ CDK CDK related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants