title: Cannot redeclare exported variable ''
body: <p>I have a npm module in another directory that I'm using in another project using <code>npm link</code>, however when I import the module and try to use the function I get the following error a bunch of errors even though the typescript compiled successfully. Here is my tsconfig for the npm module:</p>
  <pre><code>{
      &quot;compilerOptions&quot;: {
        &quot;target&quot;: &quot;es5&quot;,
        &quot;module&quot;: &quot;commonjs&quot;,
        &quot;declaration&quot;: true,
        &quot;outDir&quot;: &quot;./lib&quot;,
        &quot;strict&quot;: true,
      },
      &quot;include&quot;: [&quot;src&quot;],
      &quot;exclude&quot;: [&quot;node_modules&quot;]
  }
  </code></pre>
  <p>Here is the index.ts of the module:</p>
  <pre><code>import * as APIServices from &quot;./API/API&quot;
  import APIPage from &quot;./API/APIPage&quot;
  
  export { APIServices, APIPage }
  </code></pre>
  <p>And here is how I'm trying to use the package:</p>
  <pre><code>import APIServices from 'common-backend'
  
  console.log(APIServices)
  </code></pre>
  <p>But when I run the file I get the following errors:</p>
  <pre><code>TSError: ⨯ Unable to compile TypeScript:
  ../../common-backend/lib/index.js:3:1 - error TS2323: Cannot redeclare exported variable 'APIPage'.
  
  3 exports.APIPage = exports.APIServices = void 0;
    ~~~~~~~~~~~~~~~
  ../../common-backend/lib/index.js:3:19 - error TS2323: Cannot redeclare exported variable 'APIServices'.
  
  3 exports.APIPage = exports.APIServices = void 0;
                      ~~~~~~~~~~~~~~~~~~~
  ../../common-backend/lib/index.js:5:1 - error TS2323: Cannot redeclare exported variable 'APIServices'.
  
  5 exports.APIServices = APIServices;
    ~~~~~~~~~~~~~~~~~~~
  ../../common-backend/lib/index.js:7:1 - error TS2323: Cannot redeclare exported variable 'APIPage'.
  
  7 exports.APIPage = APIPage_1.default;
  </code></pre>
  <p>Finally this is the index.js that the errors are being thrown on:</p>
  <pre><code>&quot;use strict&quot;;
  Object.defineProperty(exports, &quot;__esModule&quot;, { value: true });
  exports.APIPage = exports.APIServices = void 0;
  var APIServices = require(&quot;./API/API&quot;);
  exports.APIServices = APIServices;
  var APIPage_1 = require(&quot;./API/APIPage&quot;);
  exports.APIPage = APIPage_1.default;
  </code></pre>
  <p>Is there something that I forgot to add in the tsconfig? Is this the fault of the compiler transpiling the typescript incorrectly? Or does it have to do something with the way I'm import and exporting the files? I've been scratching my head for a while on this one and nobody else seems to have had the same issue.</p>
  <p>Edit:
  Forgot to include the API class I'm trying to import:</p>
  <pre><code>import { Validators } from &quot;./Validators&quot;
  import { APIRoute, Config } from &quot;./helpers/Interface&quot;
  import { Router } from &quot;express&quot;
  const router = Router()
  
  class API {
      private config: Config
      private _routes: APIRoute[]
  
      constructor(config: Config) {
          this.config = config
          this._routes = []
      }
  
      get routes() : APIRoute[] {
          return this._routes
      }
      
      set routes(routes: APIRoute[]) {
          this._routes = [...routes]
      }
      
      /**
       * Add route to routes array
       * @param route 
       */
      addRoute(route: APIRoute) : void {
          this.routes.push(route)
      }
  
      /**
       * Instatiates existing routes in the routes array
       */
      loadRoutes() : void {
          for(const route of this._routes) {
              try {
                  new route.module(router, route, this.config.authFunction)
              }
              catch(error) {
                  console.error(route)
                  console.error(error)
              }
          }
      }
  }
  
  export { API, Validators, router }
  </code></pre>