How can I get type of SignalStore When Separating Store Methods into Different File in an Angular Project Using @ngrx/signals #4236
Unanswered
Anna-Bober
asked this question in
Q&A
Replies: 1 comment
-
This might work for you?
Then:
Or when also using entities:
Then:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working on an Angular project utilizing @ngrx/signals for state management. My goal is to organize my store's methods into separate files for better maintainability and readability. Specifically, I want to extract the withMethods_function from the main store definition file to a separate file and ensure proper typing for the store passed to this function.
Here is how my store is currently defined:
I attempted to define the type of the store in the main file and then use it in the separate file where withMethods_function is located:
Main File:
Separate File for Store Methods:
However, I encountered the following error: 'OrganizationsType' refers to a value, but is being used as a type here. Did you mean 'typeof OrganizationsType'?".
Could someone advise on the correct way to type the state parameter in withMethods_function when it's defined in a separate file? I suspect my approach to exporting and importing the store type might be incorrect.
I want to have the same access to store as if it was in one file.
Beta Was this translation helpful? Give feedback.
All reactions