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

    Function hasResult

    • Type guard to check if an SDK response has a result that is neither null nor undefined.

      Type Parameters

      Parameters

      • response: T

        The SDK response to check

      Returns response is Extract<T, { result: {} }>

      true if the response has a result that is neither null nor undefined, false otherwise

      const response = await someBridgeMethod();
      if (isOk(response) && hasResult(response)) {
      // response narrowed to status code `200` variant, and `result` is available
      console.log('Result:', response.result);
      }