TypeScript: The problem with function overloads
Briefly

The main goal of the function overloads is to condition the return type according to the input parameters...
Similarly to function overloads, the return type is properly inferred according to the input value...
Unlike function overloads, uncertain input values are allowed and propagate to the returned type...
TypeScript struggles to infer when a string or a number should be returned, requiring 'any' type or aliases for cleaner implementation...
Read at Medium
[
|
]