Reports indexed object types that don't match the configured style.
✅ This rule is included in the ts stylistic and stylisticStrict presets.
TypeScript provides two equivalent ways to define indexed object types: Record<K, V> and { [key: K]: V }.
Using one style consistently improves code readability.
This rule enforces consistent usage of either Record<K, V> (default) or index signatures.
AEinterfa53 Data< {d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">5 sp><3[sp ansty="le--0:#D7DBE0;--1:#403F">53k3[sp>7<2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0stri3 sp>5<3]sp ansty="le--0:#7FDBCA;--1:#096E">73]sp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb3 sp>5 {d><3;d ivclassNa="meec-li">53;d><3}d ivclassNa="meco"><}d>}d>3}d>AEty53 StringMaA
<53sp ansty="le--0:#D6DE">EB {53sp>< [sp ansty="le--0:#D7DB">E0k [sp>7<2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0stri3 sp>5<3]sp ansty="le--0:#7FDBCA;--1:#096E">73]sp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0stri3 sp>53 <};d ivclassNa="meco"><};d>};d>};d>AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0proce3 sp>1<1(sp ansty="le--0:#D7DBE0;--1:#403F">53da1(sp>7<2:sp ansty="le--1:#403F"><53sp ansty="le--0:#D6DE">EB {53sp>< [sp ansty="le--0:#D7DB">E0k [sp>2:sp>7<2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0stri3 sp>5<3]sp ansty="le--0:#7FDBCA;--1:#096E">73]sp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb3 sp>53< }sp ansty="le--0:#D9F5DD;--1:#1111">1 }sp><1)sp ansty="le--0:#7FDBCA;--1:#096E">71)sp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo3 sp>53 <{}d ivclassNa="meco"><{}d>{}d>{}d> 44AE3F53 D4<4AE= spans="tyle--0:#D6DEEB;--1:#40">34AE=>1111Re361B0st3F<53, spans="tyle--0:#C5E478;--1:#3B">61B0nu53, >3F<53> ;divclass="Name">>>53>><;di vdivclass="Nameexpressive-">44AE3F53 String<4AE= spans="tyle--0:#D6DEEB;--1:#40">34AE=>1111Re361B0st3F<53, spans="tyle--0:#C5E478;--1:#3B">61B0st53, >3F<53> ;divclass="Name">>>53>>;di><;di vdivclass="Nameexpressive-">44AEfunc361B0pro1<111( spans="tyle--0:#D7DBE0;--1:#40">3F53111(>631111Re361B0st6<67B, spans="tyle--0:#D6DEEB;--1:#40">367B,>61B0nu3 spans="tyle--0:#D9F5DD;--1:#11">1><111) spans="tyle--0:#7FDBCA;--1:#09">6111)>361B03F5<3 { }divclass="Name">): voi">3 {>;di>
"record" (default): Prefer Record<K, V> over index signatures.
"index-signature": Prefer index signatures over Record<K, V>.
When set to "index-signature":
AEty53 DatA5<3 sp ansty="le--0:#FFCB8B;--1:#1111">11Reco3 sp>5<3B0stri353<, sp ansty="le--0:#C5E478;--1:#3B61">B0numb, sp>53<>;d ivclassNa="meco"><>;d>>;d>>;d> 44AE3F53 D4<4AE= spans="tyle--1:#40"><3F53 spans="tyle--0:#D6">DEEB3F53>< { [ spans="tyle--0:#D7">DBE { [>4AE=><0key spans="tyle--0:#7FDBCA;--1:#09">60key>361B0st36361B0nu3F5<3 } ;divclass="Name">3 }>
If your project already has an established convention for indexed object types that you don’t want to enforce, or if you prefer allowing both styles for flexibility, you may disable this rule.