@grabjs/superapp-sdk
    Preparing search index...

    Function isSuccess

    • Type guard to check if a JSBridge response is successful (status codes 200 or 204).

      Type Parameters

      Parameters

      • response: T

        The JSBridge response to check

      Returns response is Extract<T, { status_code: 200 | 204 }>

      True if the response is successful (200 or 204), false otherwise

      const response = await someBridgeMethod();
      if (isSuccess(response)) {
      // response narrowed to the 200/204 variants of the response union
      if (response.status_code === 200) {
      console.log(response.result);
      }
      }