You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+54-7Lines changed: 54 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ await workflow.register();
77
77
78
78
**Step 2: Write a worker**
79
79
80
-
Workers are TypeScript functions decorated with `@worker` that poll Conductor for tasks and execute them.
80
+
Workers are TypeScript functions decorated with `@worker` that poll Conductor for tasks and execute them. The example below uses the legacy decorator style (standalone function). See [Workers](#workers) for the new TypeScript 5.0+ decorator style (class methods).
@@ -215,30 +215,77 @@ All of these are type-safe, composable, and registered to the server as JSON —
215
215
216
216
## Workers
217
217
218
-
Workers are TypeScript functions that execute Conductor tasks. Decorate any functionwith`@worker` to register it as a worker (auto-discovered by `TaskHandler`) and use it as a workflow task.
218
+
Workers are TypeScript functions that execute Conductor tasks. Decorate functions with `@worker` to register them as workers (auto-discovered by `TaskHandler`) and use them as workflow tasks.
219
+
220
+
The SDK supports **both** decorator styles:
221
+
222
+
### Option 1: New decorators (TypeScript 5.0+)
223
+
224
+
Use class methods with the new Stage 3 decorators. No `experimentalDecorators` needed — remove it from your `tsconfig.json`.
225
+
226
+
```typescript
227
+
import { worker, TaskHandler } from "@io-orkes/conductor-javascript";
228
+
import type { Task } from "@io-orkes/conductor-javascript";
0 commit comments