typings problem
#4383
Replies: 2 comments 3 replies
-
You do that via the function setColor(color: string, store: StateSignal<StoreA>) {
patchState(store, { color });
} or function setColor(color: string, store: StateSignal<StoreA>) {
patchState(store, state => ({color}));
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
Ok, then you have that option: export const testStoreA = signalStore(
{ providedIn: 'root' },
withState<StoreA>(initialStateA),
withComputed((state) => ({
combined: computed(() => state.color + ' ' + state.size.toString()),
})),
withMethods((store) => ({
setColor: (color: string) => patchState(store, { color }),
}))
);
type TestStoreA = InstanceType<typeof testStoreA>;
function doSomethingWithStore(color: string, store: TestStoreA) {
store.setColor(color);
} As you see, I don't call |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, suppose I have this:
My question is how do I properly type SomeStoreType and SomeStateType to get proper Intellisense on the state field within the patchState function.
Beta Was this translation helpful? Give feedback.
All reactions