Reports member access on a value with type any.
✅ This rule is included in the ts logical and logicalStrict presets.
Accessing a member of a value typed as any creates a potential type safety hole and source of bugs.
TypeScript cannot verify that the member exists or what type it has.
This rule disallows member access on any variable that is typed as any.
This includes:
- Property access on
any typed values (e.g., anyValue.property)
- Element access on
any typed values (e.g., anyValue[0])
- Using
any typed values as computed property keys (e.g., obj[anyKey])
AEdeclare consB0val7<2:sp ansty="le--0:#C792EA;--1:#8844">A2:sp>B0a5<3;d ivclassNa="meec-li">53valA72proper53;d><3;d ivclassNa="meco">3;d>AEdeclare consB0val7<2:sp ansty="le--0:#C792EA;--1:#8844">A2:sp>B0a5<3;d ivclassNa="meec-li">53valu1<1"sp ansty="le--0:#ECC48D;--1:#984E">4Dproper1"sp>1<1"sp ansty="le--0:#D6DEEB;--1:#403F">531"sp>3;d><];d ivclassNa="meco"><];d>];d>];d>AEdeclare consB0val7<2:sp ansty="le--0:#C792EA;--1:#8844">A2:sp>B0a5<3;d ivclassNa="meec-li">53valA1<1asp ansty="le--0:#C792EA;--1:#8844">A1asp>1<1bsp ansty="le--0:#C792EA;--1:#8844">A1bsp>7<2csp ansty="le--0:#D6DEEB;--1:#403F">52csp>3;d><3;d ivclassNa="meco">3;d>AEdeclare consB0o7<2:sp ansty="le--0:#C792EA;--1:#8844">AE 2:sp><{ sp ansty="le--0:#D6DEEB;--1:#403F">5{ sp><3asp ansty="le--0:#7FDBCA;--1:#096E">73asp><2:sp ansty="le--0:#C792EA;--1:#8844">A2:sp>B0numbAE< }sp ansty="le--0:#D6DEEB;--1:#403F">5 }sp><3;d ivclassNa="meec-li">AEdeclare consB0k7<2:sp ansty="le--0:#C792EA;--1:#8844">A2:sp>B0a53;d><3;d ivclassNa="meec-li">53obj[key3;d><];d ivclassNa="meco"><];d>];d>];d> 44AEdeclare co61B0v644A3F53prop64<4AE spans="tyle--0:#C5E478;--1:#3B">61B0st4AE >4433F53v4<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E72prop4AE.>3<;di vdivclass="Nameexpressive-">44AEdeclare co61B0v64<4AE spans="tyle--0:#C5E478;--1:#3B">61B0st4AE >3F5<3[] ;divclass="Nameec-">3F53va0<9820 spans="tyle--0:#D6DEEB;--1:#40">3F9820>3[]><53] ;divclass="Name"><[0]>[0]>53]>;di><;di vdivclass="Nameexpressive-">44AEdeclare co61B0v64<4AE spans="tyle--0:#FFCB8B;--1:#11">1111Re4AE >4<4AE< spans="tyle--0:#C5E478;--1:#3B">61B0st4AE<>4461B0nu4<4AE> spans="tyle--0:#D6DEEB;--1:#40">34AE>>44AEdeclare co61B<0key spans="tyle--0:#7FDBCA;--1:#09">60key>4<4AE spans="tyle--0:#C5E478;--1:#3B">61B0st4AE >33F53value[k;declare const key: string;value[k">;di><;di vdivclass="Nameexpressive-">44AEdeclare co61B<0map spans="tyle--0:#7FDBCA;--1:#09">60map>4<4AE spans="tyle--0:#FFCB8B;--1:#11">1114AE ><1Map spans="tyle--0:#C792EA;--1:#88">41Map><4AE< spans="tyle--0:#C5E478;--1:#3B">61B0st4AE<>4461B0nu4<4AE> spans="tyle--0:#D6DEEB;--1:#40">34AE>>3F5<3map spans="tyle--0:#C792EA;--1:#88">43map><4AE. spans="tyle--0:#82AAFF;--1:#3B">61B4AE.><0get spans="tyle--0:#D6DEEB;--1:#40">30get>1<111" spans="tyle--0:#ECC48D;--1:#98">4E4111">1<111" spans="tyle--0:#D6DEEB;--1:#40">3F111"><53) ;divclass="Name">;map.get("ke">53)>;di>
This rule is not configurable.
If your codebase has many existing any values or areas of unsafe code, enabling this rule may be challenging.
It may be more practical to defer enabling this rule until type safety has been improved in those areas.
You might consider using Flint disable comments and/or configuration file disables for those specific situations instead of completely disabling this rule.