> ## Documentation Index
> Fetch the complete documentation index at: https://gadget.aurelienbbn.com/llms.txt
> Use this file to discover all available pages before exploring further.

# action-require-action-run-type

> Require Gadget action run and onSuccess exports to use generated type annotations.

| Recommended                                  | Strict                                     | Auto-fixable                                | Scope               |
| -------------------------------------------- | ------------------------------------------ | ------------------------------------------- | ------------------- |
| <Badge color="orange" size="sm">warn</Badge> | <Badge color="red" size="sm">error</Badge> | <Badge color="green" size="sm">true</Badge> | Gadget action files |

**What the linter reports:**

* Use ActionOnSuccess for onSuccess.
* Use ActionRun for run.
* Type onSuccess as ActionOnSuccess.
* Type run as ActionRun.

## Examples

<Tabs>
  <Tab title="Incorrect">
    ```ts title="api/models/widget/actions/create.ts" theme={null}
    import { applyParams, save } from "gadget-server";
    // missing ActionRun type annotation
    export const run = async ({ params, record }) => {
      await applyParams(record, params);
      await save(record);
    };
    ```
  </Tab>

  <Tab title="Correct">
    ```ts title="api/models/widget/actions/create.ts" theme={null}
    import { applyParams, save } from "gadget-server";
    // ActionRun provides type-safe params and record
    export const run: ActionRun = async ({ params, record }) => {
      await applyParams(record, params);
      await save(record);
    };
    ```
  </Tab>
</Tabs>
