Skip to content

overloadSignaturesAdjacent

Require that function overload signatures be consecutive.

✅ This rule is included in the ts stylistic and stylisticStrict presets.

Function overload signatures represent multiple ways a function can be called with different parameter types or return types. When overload signatures are separated by other code, it becomes harder to see the full API of a function at a glance. Grouping all overload signatures for a function together makes code easier to read and understand.

This rule reports when a function’s overload signatures are not adjacent to each other.

AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B<0fsp ansty="le--0:#D9F5DD;--1:#1111">1<1(sp ansty="le--0:#D7DBE0;--1:#403F">5<3xsp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb1<1)sp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo5<3;d ivclassNa="meec-li">AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0oth11<()sp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo53 <{}d ivclassNa="meec-li">AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B<0fsp ansty="le--0:#D9F5DD;--1:#1111">1<1(sp ansty="le--0:#D7DBE0;--1:#403F">5<3xsp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0stri1<1)sp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo5<3;d ivclassNa="meec-li">AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B<0fsp ansty="le--0:#D9F5DD;--1:#1111">1<1(sp ansty="le--0:#D7DBE0;--1:#403F">5<3xsp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb5<3 sp ansty="le--0:#7FDBCA;--1:#096E">7<2|sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0stri1<1)sp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo53 <{}d ivclassNa="meco"><{}d>AEinterfa53 I< {d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0meth1<1(sp ansty="le--0:#D7DBE0;--1:#403F">5<3xsp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb1<1)sp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo5<3;d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0oth11<()sp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo5<3;d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0meth1<1(sp ansty="le--0:#D7DBE0;--1:#403F">5<3xsp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0stri1<1)sp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo5<3;d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0meth1<1(sp ansty="le--0:#D7DBE0;--1:#403F">5<3xsp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb5<3 sp ansty="le--0:#7FDBCA;--1:#096E">7<2|sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0stri1<1)sp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo5<3;d ivclassNa="meec-li">5<3}d ivclassNa="meco"><}d>
44AEfunc36<1B0f spans="tyle--0:#D9F5DD;--1:#11">1<111( spans="tyle--0:#D7DBE0;--1:#40">36361B0nu1<111) spans="tyle--0:#7FDBCA;--1:#09">6361B0344AEfunc36<1B0f spans="tyle--0:#D9F5DD;--1:#11">1<111( spans="tyle--0:#D7DBE0;--1:#40">36361B0st1<111) spans="tyle--0:#7FDBCA;--1:#09">6361B0344AEfunc36<1B0f spans="tyle--0:#D9F5DD;--1:#11">1<111( spans="tyle--0:#D7DBE0;--1:#40">36361B0nu36361B0st1<111) spans="tyle--0:#7FDBCA;--1:#09">6361B03F5<3 { }divclass="Name"><}di vdivclass="Nameexpressive-">44AEinter3F53< I {divclass="Nameec-">de61B0me1<111( spans="tyle--0:#D7DBE0;--1:#40">36361B0nu1<111) spans="tyle--0:#7FDBCA;--1:#09">6361B03de61B0me1<111( spans="tyle--0:#D7DBE0;--1:#40">36361B0st1<111) spans="tyle--0:#7FDBCA;--1:#09">6361B03de61B0me1<111( spans="tyle--0:#D7DBE0;--1:#40">36361B0nu36361B0st1<111) spans="tyle--0:#7FDBCA;--1:#09">6361B033

This rule is not configurable.

It can sometimes be useful to place overload signatures alongside other meaningful parts of a type. For example, if each overload corresponds to a different property, you might wish to place each overload next to its property. You might consider using Flint disable comments and/or configuration file disables for those specific situations instead of completely disabling this rule.