Signal store - How to get the types right for a custom store feature that uses factory-method? #4566
Unanswered
PhilippMDoerner
asked this question in
Q&A
Replies: 1 comment 2 replies
-
@PhilippMDoerner did you try to use |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Heyho, thought I'd make a new question as this is the result of this question.
I'm now trying to make a
withQueries
signal-store-feature that takes a factory function same aswithMethods
.There the user defines a dictionary of queries - functions that return observables - whose data gets transferred to the store etc.
The fields I create are based on the keys on the returned object by the factory, so the syntax I'm going for is something like this:
Which should create a store with the added state signals:
someVal
,data1
,data1Errors
,data1QueryState
,data2
,data2Errors
,data2QueryState
as well as the rxMethodsloadData1
andloadData2
.Now I'm struggling to create a way to add that state from said factory function, as apparently the type of the store does not match what I'm expecting (?).
This is as far as I've gotten so far (Note, there are some import errors in the stackblitz that do not occur locally on my machine, notably when importing from
'@ngrx/signals/src/signal-store-models'
):Beta Was this translation helpful? Give feedback.
All reactions