Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withCalls typedCallConfig that has a no resultProp and a call with no parameters doesnt generate the correct types #74

Closed
gabrielguerrero opened this issue May 16, 2024 · 1 comment
Labels

Comments

@gabrielguerrero
Copy link
Owner

The following code should generate a property called testCallResult but it doesn't, and also damages the previous function types removing them from the store.

const Store = signalStore(
withState({ foo: 'bar' }),
withCalls((store) => ({
testCall: typedCallConfig({
call: () => {
return of(true);
},
onSuccess: (result) => {
// patchState should be able to update the store inside onSuccess
patchState(store, { foo: result });
},
onError,
}),
})),
);
As a workaround you can omit using typedCallConfig and use an object for the config but that loses the type for the result on the onSuccess method

gabrielguerrero pushed a commit that referenced this issue May 16, 2024
…o resultProp and no params call

Fixed bug that was making withCalls lose types when a typeCallConfig had a call with no params and
no resultProp

fix #74
Copy link

🎉 This issue has been resolved in version 17.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant