From c6acd075e7c74de41d3191dfb2f59eae0ea7a544 Mon Sep 17 00:00:00 2001 From: yiling Date: Wed, 15 Jul 2026 11:58:17 +0800 Subject: [PATCH] refactor(workflow-core): statically import Worker type from @temporalio/worker to ensure activeWorkers type-safety --- packages/workflow-core/src/workflow.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/workflow-core/src/workflow.ts b/packages/workflow-core/src/workflow.ts index 1eed7b1b..18050706 100644 --- a/packages/workflow-core/src/workflow.ts +++ b/packages/workflow-core/src/workflow.ts @@ -7,9 +7,11 @@ import { LocalExecutor } from './local-executor' import { TemporalExecutor } from './temporal-executor' import { TaskQueueAgent, TaskQueueTranscode, getConcurrencyLimit } from './workflow-utils' +import type { Worker } from '@temporalio/worker' + export class WorkflowService { private executor: Executor - private activeWorkers: unknown[] = [] + private activeWorkers: Worker[] = [] constructor() { const type = process.env.WORKFLOW_EXECUTOR || 'local' @@ -74,9 +76,7 @@ export class WorkflowService { } async shutdownWorkers(): Promise { - await Promise.all( - this.activeWorkers.map((w) => (w as { shutdown: () => Promise }).shutdown()), - ) + await Promise.all(this.activeWorkers.map((w) => w.shutdown())) this.activeWorkers = [] }