-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patch methods do not correctly resolve generic collection names withEntities #4638
Comments
Note: This is not a regression, the same behavior is present in NgRx Signals v18. |
I wonder if it is the same issue as me, or similar ? If it is, I'll mark it as duplicate. |
No, this issue is specifically about named collections of entities and their types. So this is compile time issue rather than runtime. |
So far nailed this to this small example: const state : NamedEntityState<User, Collection> = undefined as any;
const partialState : Partial<NamedEntityState<User, Collection>> = state; with error:
|
…llection names withEntities Ensures type-safety of named entity collections with patchState helpers fixes ngrx#4638
Which @ngrx/* package(s) are the source of the bug?
signals
Minimal reproduction of the bug/regression with instructions
A TypeScript error occurs when attempting to use the patchState function with addEntity on a store with
withEntities
. The error indicates a type mismatch between PartialStateUpdater<NamedEntityState<E, Collection>> and the expected parameter type.https://stackblitz.com/edit/vitejs-vite-nuijcczs?file=src%2Fmain.ts
Expected behavior
Collection extends string
generic could be used to make this feature type-safe and allow method naming like inngrx-toolkit withDataService
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)
"@ngrx/signals": "^19.0.0",
Other information
No response
I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: