indexed() function
Exposes a complex service type that carries an index signature.
Signature:
export declare function indexed(indexTypedef: string | Thunk): any;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
indexTypedef |
string | Thunk |
the index signature as raw source text, for example |
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() — 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
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;
}
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.