TaskFunction

TaskFunction<TArgs = void, TReturn = unknown> = (args: TArgs) => TReturn | Promise<TReturn>

Source: task.ts:154

Function signature for a TypeScript task handler.

TArgs describes what the Dag's call site passes. getContext and getClient reach the runtime from inside the call, so neither is a parameter.

CODE
interface TransformArgs {
  regionCode: string;
  threshold: number;
}

async function transform({ regionCode, threshold }: TransformArgs) {
  // ...
}

A handler that takes no arguments declares no parameter.

Non-undefined return values are automatically pushed to XCom under the "return_value" key, matching Python @task behavior.

Type Parameters

  • TArgs = void
  • TReturn = unknown

Parameters

  • args (TArgs)

Returns

  • TReturn | Promise<TReturn>