> For the complete documentation index, see [llms.txt](https://type.angular-package.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://type.angular-package.dev/type/callbackpayload.md).

# CallbackPayload

## `CallbackPayload`

Experimental shape for a generic type variable `Payload`.

{% code title="callback-payload.type.ts" %}

```typescript
type CallbackPayload<Payload = object> = GenericObject & {
  action?: string;
  name?: string;
  param?: string;
} & Payload;
```

{% endcode %}

### Generic type variables

#### <mark style="color:green;">`Payload`</mark>`=`<mark style="color:green;">`object`</mark>

The shape of the optional `payload` parameter, by default equal to the [`object`](https://www.typescriptlang.org/docs/handbook/basic-types.html#object).

### Properties

#### `action?: string`

An optional action of a [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) type that describes the cause of performed callback.

#### `name?: string`

An optional name of the function or method of a [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) type that performed callback.

#### `param?: string`

An optional name of the parameter of a [`string`](https://www.typescriptlang.org/docs/handbook/basic-types.html#string) type to which performed callback relates.

### Example usage

```typescript
// Example usage.
import { CallbackPayload, ResultCallback } from '@angular-package/type';

// Create a new function.
const isString = (
  value: any,

  // Parameter callback of `ResultCallback` type with the `CallbackPayload`.
  callback: ResultCallback<any, CallbackPayload>
): any => {
  callback(typeof value === 'string', {
    // Property from the `CallbackPayload`.
    action: 'Checks the string of a firstName',

    // Property from the `CallbackPayload`.
    name: 'isString',

    // Property from the `CallbackPayload`.
    param: 'value',

    // Custom property.
    firstName: 'my Name',
  });
};

// The use of the `isString()` function.
isString('it is a string', (result: boolean, value, payload) => {
  if (payload !== undefined) {
    /*
    Returns {
      action: "Checks the string of a firstName",
      firstName: "my Name",
      name: "isString",
      param: "value",
    }
    */
    console.log(payload);
  }
  return result;
});
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://type.angular-package.dev/type/callbackpayload.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
