Open
Description
Which @ngrx/* package(s) are relevant/related to the feature request?
signals
Information
The withEntities
feature uses EntityId
for the entities' id, which is defined as export type EntityId = string | number
.
We have a use case where we need to narrow down the type of the id to (e.g.) UUID
(or some other sub-type of string
).
So I'd suggest adding a second optional type arg to withEntities()
like this:
export declare function withEntities<Entity, Id extends EntityId = EntityId>(): SignalStoreFeature<EmptyFeatureResult, {
state: EntityState<Entity, Id>;
computed: EntityComputed<Entity, Id>;
methods: {};
}>;
Describe any alternatives/workarounds you're currently using
At the moment we need to cast the id from EntityId
to UUID
:
signalStore(
withEntities<V>(),
withMethods((store) => ({
allIds(): K[] {
return store.ids() as K[];
},
//...
)
I would be willing to submit a PR to fix this issue
- Yes
- No