title: is return-type signature in function overloading useless?
body: <p>Function overloading in Typescript has a unexpected behavior.</p>
  
  <p>Taking a look at the function overloading <a href="http://www.typescriptlang.org/Handbook#functions-overloads" rel="nofollow">example</a>, the return-value signature is part of the function overloading. However, the return type seems to get ignored completely. It is not necessary for Typescript to 'pick' the correct function argument signature and, what bothers me most, it is not used for checking the correct return value. </p>
  
  <p>If the return value of card is changed from a number to a string, Typescript doesn't give any warning.</p>
  
  <pre><code>function pickCard(x: {suit: string; card: number; }[]): number;
  function pickCard(x: number): {suit: string; card: number; };
  function pickCard(x): any {
    // Check to see if we're working with an object/array
    // if so, they gave us the deck and we'll pick the card
    if (typeof x == "object") {
      var pickedCard = Math.floor(Math.random() * x.length);
      return pickedCard;
    }
    // Otherwise just let them pick the card
    else if (typeof x == "number") {
      var pickedSuit = Math.floor(x / 13);
      return { suit: suits[pickedSuit], card: x % 13 }; // &lt;-- change to card: '13'
    }
  }
  </code></pre>
  
  <p>My question is: am I interpreting the overload mechanism correctly, so is supplying a return-value signature not necessary or it this a bug?</p>