17 Replies
I'm returning an object within an action, wondering if that is the issue
depends on your code some but you may need to add a type annotation or cast
Should I be casting server side?
The error points to client side code and not even the action I'm using

That's would probably work, casting the return value of the action sandboxChat
Yeah, server-side
casting as any doesn't seem to work
where are you casting to any?
want to screenshare for a few minutes?
async ({ runQuery }, chats, listingId): Promise<any>
and
return { intent: intentResponseObj, response: resBody } as any;
i need to get going but i'll be back on tomorrow. only affecting the production build so not super urgentcasting the whole action inside the wrapper may help
do you mind giving me an example?
or instead of any, as the right type
This is tradeoff we're making for better completion and less codegen at this point, but it's pretty annoying when it happens.
This throws this error

this is the function for reference
https://codepaste.xyz/posts/qShHONDXUGuLg10uW087
I haven't been able to reproduce your error yet, but the syntax I meant for the any cast looks like this
What's the version of TypeScript you're using here? I'd love to get a repro of this, I think this file is interacting with others
there are a few more steps you could take here, one is using
actionGeneric
instead of action like
I think that any time I've encountered this it's been sufficient to annotate the return type of the function passed to
action
(or query
or mutation
). Your attempt might not be working because you're annotating as Promise<any>
rather than something more specific (e.g. Promise<string>
). Could be worth trying the latter and seeing if that helps. Even Promise<{ intent: any; response: any }>
might be better!gotcha thank you will give those a shot
this fix worked thank you!
Woohoo, no problem!