> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# consistent-indexed-object-style

[Added in v0.1.14](https://github.com/web-infra-dev/rslint/releases/tag/v0.1.14)
## Configuration

| Preset                            | Configured Value |
| --------------------------------- | ---------------- |
| ✅ ts.configs.stylistic            | `"error"`        |
| ✅ ts.configs.stylisticTypeChecked | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
  ts.configs.recommended,
  {
    rules: {
      '@typescript-eslint/consistent-indexed-object-style': 'error',
    },
  },
]);
```

## Rule Details

Require or disallow the `Record` type. TypeScript supports defining object types with an index signature or using the built-in `Record` utility type. This rule enforces a consistent style.

The rule supports two modes: `"record"` (default) prefers `Record<string, T>` over index signatures, and `"index-signature"` prefers index signatures over `Record`.

Examples of **incorrect** code for this rule (with default `"record"` option):

```typescript
interface Foo {
  [key: string]: unknown;
}

type Bar = {
  [key: number]: string;
};
```

Examples of **correct** code for this rule (with default `"record"` option):

```typescript
type Foo = Record<string, unknown>;
type Bar = Record<number, string>;

interface Baz {
  [key: string]: unknown;
  name: string; // has other members, so it's fine
}
```

## Original Documentation

- [typescript-eslint: consistent-indexed-object-style](https://typescript-eslint.io/rules/consistent-indexed-object-style)
- [Source code](https://github.com/typescript-eslint/typescript-eslint/blob/v8.67.0/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts)
