Narrowing function return type
true as an argument causes the function to return a number while passing false causes it to return a boolean. The inferred return type is however always number | boolean regardless of what argument is passed.I guess this is just a quirk with TS not narrowing function signature based on arguments passed. Is it possible to achieve this however in an elegant way?
