How do you type a function that returns different types based on its arguments?
Function overloading works, but the implementation signature often ends up as a loose union that defeats the purpose. What's your go-to pattern for truly discriminating return types — overloads, generics with conditional types, or something else?
19
0 comments