title: Adding Typescript to Coffeescript
body: <p>I have a build chain setup that will convert a file from coffeescript to typescript to javascript. My question is: what is the most minimally intrusive way to add type signatures to a coffeescript function?</p>
  
  <p>coffeescript supports raw javascript through backticks. However, that means coffeescript no longer understands the backtick snippet.</p>
  
  <p>Coffeescript rejects these:</p>
  
  <pre><code>f = (`a:String`) -&gt; a + 2
  f = (a`:String`) -&gt; a + 2
  </code></pre>
  
  <p>I can write this above the function:</p>
  
  <pre><code>`var f = (String) =&gt; any`
  </code></pre>
  
  <p>It compiles, but does not do the type-checking. I think this is because Coffeescript already declared the variable.</p>
  
  <p>The only way I could figure out how to make it work requires a lot of boilerplate</p>
  
  <pre><code>f = (a) -&gt;
    `return (function(a:String){`
    a + 2;
    `})(a)`
  </code></pre>
  
  <p>Backticks do not seem to work properly in the new Coffeescript Redux compiler:
  <a href="https://github.com/michaelficarra/CoffeeScriptRedux/issues/71" rel="noreferrer">https://github.com/michaelficarra/CoffeeScriptRedux/issues/71</a></p>
  
  <p>I am well aware that this is a dubious endeavor, it is just an experiement right now. I currently use contracts.coffee, but I am looking for actual types.</p>