-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Which @ngrx/* package(s) are relevant/related to the feature request?
signals
Information
Hi, i built an application that uses an entity signal store with a big set of functions so to clean up the file i moved all the entity update functions inside another file to make them reusable too.
The problem is that functions like: UpdateEntity requires an EntityChanges<NoInfer> as the changes property and that can be both an Entity or a function to update an entity.
The issue is that if i have the update function extracted and moved to another file the function can not be securely typed as EntityChanges<...<...>> because EntityChanges is not an exported member from "@ngrx/signals/entities/src/models" so I cannot do an import like:
import { EntityChanges } from '@ngrx/signals/entities';
and create a function as:
export function updateMyEntity(): EntityChanges<NoInfer<MyEntity>> {
return (myEntity) => {
// Some Changes
}
}
Describe any alternatives/workarounds you're currently using
For now i created a custom type inside my file
type EntityChanges =
| Partial<NoInfer<MyEntity>>
| ((entity: NoInfer<MyEntity>) => Partial<NoInfer<MyEntity>>);
So that i can use it as:
export function updateMyEntity(): EntityChanges {
return (myEntity) => {
// Some Changes
}
}
I would be willing to submit a PR to fix this issue
- Yes
- No