[X] I verified that the issue exists in the latest next-safe-action release
Is there an existing issue for this?
[X] I have searched the existing issues and found nothing that matches
Describe the bug
Hello, thank you for this great plugin!
Since I updated from "next-safe-action": "^7.0.0-next.32" to next-safe-action": "^7.7.0" I get the following error everywhere in my code base.
Example:
export const testAction = actionClient
.action(async (args) => {
return "Sample String";
})
// In component:
const t = useAction(testAction, {
onSuccess: (args) => {
arr.push(args.data); // Argument of type string | undefined is not assignable to parameter of type string
},
});
args.data has the following type: string | undefined, even though if the action succeeds (onSuccess), the returned data is always string. This happens to all types such as objects that get returned from the database.
Maybe I am missing something?
Thanks for your help :)
Reproduction steps
Put code as stated above and see typescript error.
Expected behavior
onSuccessargs.data type should not be possibly undefined.
Are you using the latest version of this library?
Is there an existing issue for this?
Describe the bug
Hello, thank you for this great plugin!
Since I updated from
"next-safe-action": "^7.0.0-next.32"
tonext-safe-action": "^7.7.0"
I get the following error everywhere in my code base.Example:
args.data
has the following type:string | undefined
, even though if the action succeeds (onSuccess
), the returned data is alwaysstring
. This happens to all types such as objects that get returned from the database.Maybe I am missing something?
Thanks for your help :)
Reproduction steps
Put code as stated above and see typescript error.
Expected behavior
onSuccess
args.data
type should not be possibly undefined.Minimal reproduction example
https://rb.gy/91uk80
Operating System
Windows 10
Library version
7.7.0
Next.js version
14.2.3
Additional context
No response