I'm bit old-school and I want to type everything I can. I also can't abide red-squigglies. ๐
So when I call this:
const actionResult = Astro.getActionResult(actions.processComment);`
I really want actionResult to be typed.
So getActionResult appears to return something like SafeResult<data, error> , but when I type things:
const actionResult: SafeResult<CommentResponse, z.ZodError> = Astro.getActionResult(actions.processComment);
I get a red-squiggly under actionResult.
Am I trying too hard? ๐
My action is declared as:
export const server = {
processComment: defineAction({
accept: 'form',
input: commentCheckerInputParams,
handler: async (aInput: commentCheckerInput): Promise<CommentResponse> => {
const commentChecker = new CommentChecker();
const commentResponse: CommentResponse = await commentChecker.checkComment(aInput);
console.log("commentResponse: ", commentResponse);
return commentResponse;
},
})
}