guan404ming commented on code in PR #74069:
URL: https://github.com/apache/airflow/pull/74069#discussion_r4165037458


##########
airflow-core/docs/authoring-and-scheduling/language-sdks/typescript.rst:
##########
@@ -359,6 +359,34 @@ there. Set it once on the Dag and each task inherits it:
 ``queue`` on a task wins over the Dag's. See 
:ref:`typescript-sdk/coordinator-config` for the
 ``queue_to_coordinator`` entry that sends that queue to the coordinator.
 
+Conditional branching
+~~~~~~~~~~~~~~~~~~~~~
+
+``dag.if`` takes a handler that returns a boolean, and names the task each 
outcome runs:
+
+.. code-block:: typescript
+
+    async function hasRows({ rows }: { rows: number }): Promise<boolean> {
+      return rows > 0;
+    }
+
+    const gate = dag.if(hasRows)({ rows: extracted });

Review Comment:
   I originally followed the existing `dag.task(fn)({ ... })` convention, but I 
agree this aligns better with Go's `dag.If(fn, airflow.Inputs(...))`. 
   
   Updated to `dag.if(fn, inputs?)` / `dag.if(fn, "task_id", inputs?)`, and 
applied the same shape to dag.switch in #74070.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to