Reports calling a value with type any.
✅ This rule is included in the ts logical and logicalStrict presets.
Calling a value typed as any creates a potential type safety hole and source of bugs.
TypeScript cannot verify that the value is actually a function, what parameters it expects, or what it returns.
This rule disallows calling any value that is typed as any or Function.
This includes:
- Regular function calls on
any typed values
- Constructor calls with
new on any typed values
- Tagged template literals using
any typed values as the tag
The Function type behaves almost identically to any when called, so this rule also disallows calling values of type Function that have no call or construct signatures.
AEdeclare consB0val7<2:sp ansty="le--0:#C792EA;--1:#8844">A2:sp>B0a5<3;d ivclassNa="meec-li">B0val53(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">53valAB0proper53(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">72n5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0val3 sp>53(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">B0val5<3`sp ansty="le--0:#ECC48D;--1:#3B61">B0templa3`sp>5<3`sp ansty="le--0:#D6DEEB;--1:#403F">53`sp>3;d><3;d ivclassNa="meco"><`;d>`;d>3;d>AEdeclare consB0val7<2:sp ansty="le--0:#C792EA;--1:#8844">A2:sp>11Functi5<3;d ivclassNa="meec-li">B0val53(3;d><);d ivclassNa="meco"><);d>);d>);d> 44AEdeclare co61B0v64<4AE spans="tyle--0:#D9F5DD;--1:#11">114AE ><11() spans="tyle--0:#C792EA;--1:#88">44AE11()>< => spans="tyle--0:#C5E478;--1:#3B">61B0 => >361B0v3F5<3() ;divclass="Name"> void;valu">3()><;di vdivclass="Nameexpressive-">44AEdeclare co61B0ob644A61B0me11<11() spans="tyle--0:#7FDBCA;--1:#09">611()>4<4AE spans="tyle--0:#C5E478;--1:#3B">61B04AE >4433F53ob4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0me4AE.>3F5<3() ;divclass="Name">3()>;di><;di vdivclass="Nameexpressive-">44AEdec344AEc31111Constru3F5<3 { }divclass="Nameec-">6E7<2new spans="tyle--0:#D6DEEB;--1:#40">32new>61B0Constru3F53 {><3() ;divclass="Name">3()>;di><;di vdivclass="Nameexpressive-">44AEco61B<0tag spans="tyle--0:#C792EA;--1:#88">44A0tag>1<111( spans="tyle--0:#D7DBE0;--1:#40">3F53str111(>64<4AE spans="tyle--0:#FFCB8B;--1:#11">1111TemplateStringsA4AE >446E7<2... spans="tyle--0:#D7DBE0;--1:#40">3F53va2...>64<4AE spans="tyle--0:#C5E478;--1:#3B">61B0unk4AE >3F<53[] spans="tyle--0:#D9F5DD;--1:#11">153[]><111) spans="tyle--0:#C792EA;--1:#88">44AE111)>< => spans="tyle--0:#D6DEEB;--1:#40">3F53stri => >0<9820 spans="tyle--0:#D6DEEB;--1:#40">3F9820><53] ;divclass="Nameec-">61B<0tag spans="tyle--0:#D6DEEB;--1:#40">30tag>61B0temp3353]> strings[0];tag`templa">;di><;di vdivclass="Nameexpressive-">44AEinter3F53 SafeFunct44AEext361B0Func3F<53 {divclass="Nameec-">de11<11() spans="tyle--0:#7FDBCA;--1:#09">611()>361B0353 >344AEdeclare co61B0v64<4AE spans="tyle--0:#FFCB8B;--1:#11">1111SafeFunc4AE >361B0v3F5<3() ;divclass="Name">3()>;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 lint disable comments for specific situations instead of completely disabling this rule.