makeFunctionReference function type
I want to get the type when i run this, i know ctx.scheduler doesn't care about type but i want to run the function in the action through the right function ctx.runQuery or runMutation/action. without having to know the function type. Wondering if there is a trick with typescript?
5 Replies
I'm not sure what you mean here, @ampp could you say more?
Do you want to run a query, mutation, or action from an action and you don't know ahead of time which one it is because you're saving it as a string or something?
Showing some code could help here
after this in order to use ctx.runAction/runMutation/runQuery you need to know what the type for an if statement. the "hack" would be to run a scheduled query that accepts any of the function types.
Got it, and "string" is a function that you don't know the type of? In general yes there could be a way to
ctx.runAnyKindOfFunction(string)
someday, but we'd want to understand what your goal is here. Other upcoming improvements could help, like codegening a list of every public function that exists.
Backing up, what's your goal here? How are you getting a string for a function that you don't know the type of?I've been writing a event management system, but this particular one is for a scheduled function retry during dev(so far), i don't really want to retry it in the scheduler. However im also going to have a event function registry that is db backed that i would have the names of the functions, i don't want to have to keep the type up to date manually. And it would be nice to not have to store it.
I don't think we have an API exposed for this, you'll have store the function type.