typescript/consistent-indexed-object-style Style
What it does
Require or disallow the Record
type.
Why is this bad?
Inconsistent style for indexed object types can harm readability in a project.
Examples
Examples of incorrect code for this rule:
ts
interface Foo {
[key: string]: unknown;
}
type Foo = {
[key: string]: unknown;
};
Examples of correct code for this rule:
ts
type Foo = Record<string, unknown>;
How to use
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny typescript/consistent-indexed-object-style
json
{
"rules": {
"typescript/consistent-indexed-object-style": "error"
}
}