type WorkerHandler = (payload: TPayload) => TResult | Promise<TResult>
Handler function type for worker messages