WaspW
Wasp2y ago
kancur

Jobs - Output type error following the example in docs

Hey guys! I'm following the docs on how to create a job (https://wasp-lang.dev/docs/advanced/jobs#job-definition-and-usage). Unfortunately, I'm having some type errors. I'm using openSaas template.

export const foo: MySpecialJob<Input, Output> = async ({ name }, context) => {
  console.log(`Hello ${name}!`);
  const tasks = await context.entities.Task.findMany({});
  return { tasks };
};


Error:
Type 'Output' does not satisfy the constraint 'void | JSONValue'.
  Type 'Output' is not assignable to type 'JSONObject'.
    Property 'tasks' is incompatible with index signature.
      Type '(GetResult<{ id: string; description: string; time: string; isDone: boolean; userId: number; createdAt: Date; }, unknown> & {})[]' is not assignable to type 'JSONValue'.ts(2344)


Is there some issue with the example that I missed?

Thank you for your help!
In most web apps, users send requests to the server and receive responses with some data. When the server responds quickly, the app feels responsive and smooth.
Was this page helpful?