TypeScript Narrowing Function Return Type Part 1

Narrowing return type of function is a little bit strange in TypeScript. So I share use cases below from bad to good đŸ™‚ Use Cases Usage 1 – Bad usage Notice that even I call foo(0) in line 8, when I hover mouse on foo in line 8, popup shows val parameter type as string … Continue reading TypeScript Narrowing Function Return Type Part 1