• Async version of withGroup(); automatically manages group lifecycle around async operations.

    Type Parameters

    • T

      The promise return type of the wrapped function.

    Parameters

    • label: string

      The group label for this operation.

    • fn: () => Promise<T>

      The async function to wrap.

    • collapsed: boolean = true

      If true, creates a collapsed group (default: true).

    Returns Promise<T>

    Promise resolving to the return value of the wrapped function.

    Rethrows any error or rejection from the wrapped function.

    export async function withGroupAsync<T>(
    label: string,
    fn: () => Promise<T>,
    collapsed = true,
    ): Promise<T> {
    startGroup(label, collapsed);
    try {
    return await fn();
    } finally {
    endGroup();
    }
    }