---
title: "IResult"
description: "Generic operation-result interface. Implemented by `Result<T>` and (transitively) by `AjaxResult<T>`."
canonical_url: "https://bitrix24.github.io/b24jssdk/docs/working-with-the-rest-api/types-iresult"
last_updated: "2026-07-03"
---
# IResult

> Generic operation-result interface. Implemented by `Result<T>` and (transitively) by `AjaxResult<T>`.

`IResult<T>`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} captures the success-flag-plus-data-plus-error-bag pattern used throughout the SDK. Concrete classes:

- [`Result<T>`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""}](https://bitrix24.github.io/b24jssdk/raw/docs/working-with-the-rest-api/core-result.md) — generic.
- [`AjaxResult<T>`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""}](https://bitrix24.github.io/b24jssdk/raw/docs/working-with-the-rest-api/core-ajax-result.md) — REST-aware (immutable, paginated, decodes Bitrix24 error envelopes).

## Shape

```ts-type
interface IResult<T = any> {
  readonly isSuccess: boolean
  readonly errors: Map<string, Error>

  setData(data: T | null | undefined): IResult<T>
  getData(): T | null | undefined

  addError(error: Error | string, key?: string): IResult
  addErrors(errors: (Error | string)[]): IResult
  getErrors(): IterableIterator<Error>
  getErrorMessages(): string[]
  getErrorsByKey(): Record<string, Error>
  getErrorMessagesByKey(): Record<string, string>
  hasError(key: string): boolean

  toString(): string
}
```

`AjaxResult<T>`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} narrows `setData` to `never` (immutable response), and overrides `getData()` to return [`SuccessPayload<T>`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""}](https://github.com/bitrix24/b24jssdk/blob/main/packages/jssdk/src/types/payloads.ts){rel="[\"nofollow\"]"} when `isSuccess`.

## Typical Usage Pattern

```ts
import type { IResult } from '@bitrix24/b24jssdk'

function consume<T>(result: IResult<T>) {
  if (!result.isSuccess) {
    for (const message of result.getErrorMessages()) {
      console.error(message)
    }
    return
  }
  const data = result.getData()
  // ...
}
```

## Sitemap

See the full [sitemap](/b24jssdk/sitemap.md) for all pages.
