title: TypeScript project can't compile to a proper index.js
body: <p>I'm trying to build the TypeScript project <a href="https://github.com/simpleledger/BitcoinFilesJS" rel="nofollow noreferrer">here</a> as</p>
  <pre><code>git clone https://github.com/simpleledger/BitcoinFilesJS.git test/
  cd test
  npm i
  tsc # or npx tsc
  </code></pre>
  <p>The <code>index.js</code> created is this:</p>
  <pre class="lang-js prettyprint-override"><code>&quot;use strict&quot;;
  var __createBinding = (this &amp;&amp; this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  }) : (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      o[k2] = m[k];
  }));
  var __exportStar = (this &amp;&amp; this.__exportStar) || function(m, exports) {
      for (var p in m) if (p !== &quot;default&quot; &amp;&amp; !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  };
  Object.defineProperty(exports, &quot;__esModule&quot;, { value: true });
  __exportStar(require(&quot;./lib/bfp&quot;), exports);
  __exportStar(require(&quot;./lib/utils&quot;), exports);
  //# sourceMappingURL=index.js.map
  </code></pre>
  <p>However, if I install the project as in a new directory with <code>npm i bitcoinfiles</code>, the index.js is:</p>
  <pre class="lang-js prettyprint-override"><code>let bfp = require('./lib/bfp');
  let utils = require('./lib/utils');
  let network = require('./lib/network');
  
  module.exports = {
      bfp: bfp,
      utils: utils, 
      network: network
  }
  </code></pre>
  <p>What could be causing TypeScript to generate my unclean index.js? In addition, they don't work. As you can see, the unclean <code>index.js</code> doesn't define <code>module.exports</code></p>