title: Calling properly TypeScript code from JavaScript
body: <p>On our big enterprise project we faced a situation that seems not to be very well described in the articles and the posts available in the Internet.</p>
  
  <p>We need to integrate our existing JavaScript infrastructural code that supports SPA with the code that is being developed by the other team on TypeScript. We can’t drastically change the approach (i.e. just pick a single language) for many political limitations and the development resources available. And we fully understand that’s probably it’s not a good idea to integrate two pieces of infrastructure together that are written on different languages.</p>
  
  <p>Still we need to evaluate the impact and best practices of calling TypeScript from JavaScript code.</p>
  
  <p>The justification that TypeScript is essentially compiled into JavaScript seems to be obscure because there are no trustful sources on information on the topic on how to properly consume that compiled JavaScript from handwritten JavaScript and what are the hidden caveats (or alternatives).</p>
  
  <p>It also seems that the opposite situation when TypeScript code needs to call JavaScript is surprisingly very well described.</p>
  
  <p>Any profound thoughts on the topic?</p>
  
  <p><strong>UPD</strong></p>
  
  <p>Specifically here is the list of questions we are seeking the answers now:</p>
  
  <ul>
  <li>what will be the JavaScript shape of the TypeScript API that extensively uses generics, class hierarchies, interfaces?</li>
  <li>are there any issues with bundling, minification, AMD?</li>
  <li>is it possible to have the basic Angular controller written in TypeScript and the other JavaScript Angular controller that inherits the functionality from it? What will be the caveats?</li>
  </ul>
  
  <p>Actually we think that we haven't surfaced all the questions yet. They've emerged just after a couple of hours of thinking on that topic.</p>