---
title: "GradCheckResult: interface in IR, TypeShade API reference"
description: "GradCheckResult, an interface in IR. What gradCheck returns. The intermediate representation every backend reads: nodes, statements and declarations."
url: https://typeshade.dev/api/gradcheckresult/
language: en
---

# `GradCheckResult`

Interface in IR

What gradCheck returns.

`import type { GradCheckResult } from 'typeshade'`

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

## Syntax

```ts
interface GradCheckResult {
  readonly ok: boolean;
  readonly checked: number;
  readonly worst?: { /** The parameter. */ readonly param: string; /** The index of the point in {@link GradCheckOptions.at}. */ readonly point: number; /** The component of the parameter, `0` for a scalar. */ readonly component: number; /** The component of the result, `0` for a scalar. */ readonly output: number; /** The partial derivative the derivative function gives. */ readonly derivative: number; /** The central difference. */ readonly difference: number; };
}
```

## Instance properties

**`ok` read only `boolean`**

`true` when every partial derivative is within the tolerance.

**`checked` read only `number`**

The count of partial derivatives compared.

**`worst` optional read only ``{ /** The parameter. */ readonly param: string; /** The index of the point in {@link GradCheckOptions.at}. */ readonly point: number; /** The component of the parameter, `0` for a scalar. */ readonly component: number; /** The component of the result, `0` for a scalar. */ readonly output: number; /** The partial derivative the derivative function gives. */ readonly derivative: number; /** The central difference. */ readonly difference: number; }``**

The partial derivative farthest outside the tolerance, relative to it, and where the derivative and the central difference part. Absent when `ok`.

## See also

- [`gradCheck`](https://typeshade.dev/api/gradcheck/)

## Source

[`src/core/passes/grad-check.ts`, line 36](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/passes/grad-check.ts#L36), at commit af54ddad5
