title: Signature of lambda return types in TypeScript
body: <p>In the TypeScript below both functions are the same, except that I'm trying to explicitly declare the return type in <strong>demoTwo</strong>. The return type is a function which itself takes a function as input. My question is why do I have to give the parameter name represented by <strong>whyThis</strong>, given that it will never be used? The code will not compile without something in that position.</p>
  
  <pre><code>function demoOne() {
      return function(input: () =&gt; string) : void {
          var result = input();
          console.log("Foo:",result);
      }
  }
  
  function demoTwo(): (whyThis:() =&gt; string) =&gt; void {
      return function(input: () =&gt; string) : void {
          var result = input();
          console.log("Bar:",result);
      }
  }
  
  var sampleInput = () =&gt; "wibble";
  demoOne()(sampleInput);
  demoTwo()(sampleInput);
  </code></pre>
  
  <p>To be clear what I'm asking here's the equivalent code in Scala:</p>
  
  <pre><code>object Program {
    def demoTwo(): (() =&gt; String) =&gt; Unit = {
      def tmp(input: () =&gt; String): Unit = {
        val result = input()
        println("Bar: " + result)
      }
      return tmp
    }
    def main(args: Array[String]): Unit = {
      val sampleInput = () =&gt; "wibble"
      demoTwo()(sampleInput)
    }
  }
  </code></pre>
  
  <p>If we set the declarations of <em>demoTwo</em> side by side we have:</p>
  
  <pre><code>function demoTwo(): (whyThis:() =&gt; string) =&gt; void { //TS
  def demoTwo(): (() =&gt; String) =&gt; Unit = { //Scala
  </code></pre>
  
  <p>The only major difference is that TS requires something at the <em>whyThis</em> position and Scala does not. Why should this be the case?</p>