# indexed() function · @imqueue/rpc

Source: https://imqueue.org/api/rpc/latest/rpc.indexed/
Published: 2026-08-04
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/rpc 3.5.3 — generated reference, not hand-written

Exposes a complex service type that carries an index signature.

**Signature:**

```typescript
export declare function indexed(indexTypedef: string | Thunk): any;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| indexTypedef | string \| [Thunk](https://imqueue.org/api/rpc/latest/rpc.thunk/) | the index signature as raw source text, for example `'[fieldName: string]: any'`, or a [Thunk](https://imqueue.org/api/rpc/latest/rpc.thunk/) returning it. A falsy value makes the decoration a silent no-op; a non-string is coerced with `String()`. |


**Returns:**

any

a dual-mode class decorator `(value, context?) => any`. Under standard (TC39) decorators it flushes the class's `@property` fields and records the index signature, returning `undefined`; under legacy decorators the fields are already registered, so it only attaches the index signature and returns the class unchanged.

## Remarks

Under standard decorators this is a superset of [classType()](https://imqueue.org/api/rpc/latest/rpc.classtype/) — it performs the same `@property` flush in addition to recording the index signature.

The index signature is injected verbatim into generated client interfaces and is not validated, so a malformed string produces a client that does not compile. A thunk is evaluated once, on first use.

## Example


```typescript
import { indexed, property } from '@imqueue/rpc';

// @indexed() also flushes this class's @property fields,
// so a separate @classType() is not needed
@indexed('[fieldName: string]: any')
class Schema {
    @property('string')
    name!: string;

    [fieldName: string]: any;
}
```

