title: How to use a compiled TypeScript class in Javascript
body: <p>Imagine I have this simple TypeScript class, <code>Animal.ts</code>:</p>
  
  <pre><code>export default class Animal {
    constructor(public name : string) { }
  }
  </code></pre>
  
  <p>With this <code>tsconfig.json</code> file:</p>
  
  <pre><code>{
    "compilerOptions": {
      "target": "es5",
      "module": "commonjs",
      "strict": true
    },
    "files": [
      "Animal"
    ]
  }
  </code></pre>
  
  <p>How can I use the compiled version of this class (compiled by running <code>tsc</code>) in a javascript file like so:</p>
  
  <pre><code>var Animal = require("./Animal");
  
  var newAnimal = new Animal();
  </code></pre>
  
  <p>Should I edit something in my <code>tsconfig.json</code> file? The error I get is:</p>
  
  <blockquote>
    <p>ReferenceError: Animal is not defined</p>
  </blockquote>