Don’t use the types
Number
, String
, Boolean
, Symbol
or Object
.Don’t use generic type
T
if you don’t use it! (More)Don’t use
any
. At least, use unknown
.Don’t return
any
for callbacks whose value will be ignored.It’s always legal to provide a callback that accepts fewer args. So, don’t use optional params in callbacks.
Don’t overload callbacks.
Don’t put more general overloads before more specific overloads → TS uses the first matching overload.
Use trailing params instead of overloads.
Don’t write overloads that differ by type in only one argument position.
To be continued…