Change return type based on value of parameters
I'm trying to change the return type of a function based on the value of the arguments passed to the function itself. I'm struggling to find the right documentation for it, could anyone point me in the right direction
Here's an example of what I want:
Here's an example of what I want:
Solution
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.