title: Typescript: *.ts is not a module
body: <p>I've just installed a self-made npm library on my project. </p>
  
  <p>npm is able to generate every artifacts and I've published them. So, now I'm able to use the services I've made: <code>UsersApi</code>.</p>
  
  <p>The package structure is:</p>
  
  <pre><code>ts
  │───configuration.ts
  │───index.ts
  │───variables.ts
  │
  └───api
      ───api.ts
      ───UsersApi.ts
  </code></pre>
  
  <p>The content of <code>index.ts</code> is:</p>
  
  <pre><code>export * from './api/api';
  export * from './variables';
  export * from './configuration';
  </code></pre>
  
  <p>The content of <code>api/api.ts</code> is:</p>
  
  <pre><code>export * from './UsersApi';
  </code></pre>
  
  <p>And the content of <code>api/UserApi.ts</code> is a regular typescript content:</p>
  
  <pre><code>/**
   * Living API
   * desc
   *
   * OpenAPI spec version: 1.0.2
   * 
   *
   * NOTE: This class is auto generated by the swagger code generator program.
   * https://github.com/swagger-api/swagger-codegen.git
   * Do not edit the class manually.
   */
  
  import { Inject, Injectable, Optional }                      from '@angular/core';
  import { Http, Headers, URLSearchParams }                    from '@angular/http';
  import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http';
  import { Response, ResponseContentType }                     from '@angular/http';
  
  import { Observable }                                        from 'rxjs/Observable';
  import 'rxjs/add/operator/map';
  
  //import * as models                                           from '../model/models';
  import { BASE_PATH }                                         from '../variables';
  import { Configuration }                                     from '../configuration';
  
  /* tslint:disable:no-unused-variable member-ordering */
  
  
  @Injectable()
  export class UsersApi {
      protected basePath = 'http://localhost:8082/commty/cmng';
      public defaultHeaders: Headers = new Headers();
      public configuration: Configuration = new Configuration();
  
      constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
          if (basePath) {
              this.basePath = basePath;
          }
          if (configuration) {
              this.configuration = configuration;
          }
      }
  
      /**
       * 
       * Extends object by coping non-existing properties.
       * @param objA object to be extended
       * @param objB source object
       */
      private extendObj&lt;T1,T2&gt;(objA: T1, objB: T2) {
          for(let key in objB){
              if(objB.hasOwnProperty(key)){
                  (objA as any)[key] = (objB as any)[key];
              }
          }
          return &lt;T1&amp;T2&gt;objA;
      }
  
      /**
       * Add user
       * 
       * @param user username
       * @param passwd passwd
       */
      public create(user: string, passwd: string, extraHttpRequestParams?: any): Observable&lt;{}&gt; {
          return this.createWithHttpInfo(user, passwd, extraHttpRequestParams)
              .map((response: Response) =&gt; {
                  if (response.status === 204) {
                      return undefined;
                  } else {
                      return response.json();
                  }
              });
      }
  
      /**
       * User exists
       * 
       * @param user username
       */
      public exists(user: string, extraHttpRequestParams?: any): Observable&lt;boolean&gt; {
          return this.existsWithHttpInfo(user, extraHttpRequestParams)
              .map((response: Response) =&gt; {
                  if (response.status === 204) {
                      return undefined;
                  } else {
                      return response.json();
                  }
              });
      }
  
  
      /**
       * Add user
       * 
       * @param user username
       * @param passwd passwd
       */
      public createWithHttpInfo(user: string, passwd: string, extraHttpRequestParams?: any): Observable&lt;Response&gt; {
          const path = this.basePath + `/users`;
  
          let queryParameters = new URLSearchParams();
          let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
          // verify required parameter 'user' is not null or undefined
          if (user === null || user === undefined) {
              throw new Error('Required parameter user was null or undefined when calling create.');
          }
          // verify required parameter 'passwd' is not null or undefined
          if (passwd === null || passwd === undefined) {
              throw new Error('Required parameter passwd was null or undefined when calling create.');
          }
  
  
          // to determine the Content-Type header
          let consumes: string[] = [
          ];
  
          // to determine the Accept header
          let produces: string[] = [
              'application/json'
          ];
  
  
  
  
  
          let requestOptions: RequestOptionsArgs = new RequestOptions({
              method: RequestMethod.Put,
              headers: headers,
              search: queryParameters
          });
  
          // https://github.com/swagger-api/swagger-codegen/issues/4037
          if (extraHttpRequestParams) {
              requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
          }
  
          return this.http.request(path, requestOptions);
      }
  
      /**
       * User exists
       * 
       * @param user username
       */
      public existsWithHttpInfo(user: string, extraHttpRequestParams?: any): Observable&lt;Response&gt; {
          const path = this.basePath + `/users`;
  
          let queryParameters = new URLSearchParams();
          let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
          // verify required parameter 'user' is not null or undefined
          if (user === null || user === undefined) {
              throw new Error('Required parameter user was null or undefined when calling exists.');
          }
  
  
          // to determine the Content-Type header
          let consumes: string[] = [
          ];
  
          // to determine the Accept header
          let produces: string[] = [
              'application/json'
          ];
  
  
  
  
  
          let requestOptions: RequestOptionsArgs = new RequestOptions({
              method: RequestMethod.Get,
              headers: headers,
              search: queryParameters
          });
  
          // https://github.com/swagger-api/swagger-codegen/issues/4037
          if (extraHttpRequestParams) {
              requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
          }
  
          return this.http.request(path, requestOptions);
      }
  
  }
  </code></pre>
  
  <p>I'm getting the next message:</p>
  
  <pre><code>file: 'file:///d%3A/projects/living/user-platform/project/node_modules/cest/ts/api/api.ts'
  severity: 'Error'
  message: 'File 'd:/projects/living/user-platform/project/node_modules/cest/ts/api/UsersApi.ts' is not a module.'
  at: '1,15'
  source: 'ts'
  </code></pre>
  
  <p>This is the <code>tsconfig</code>'s content:</p>
  
  <pre><code>{
      "compilerOptions": {
          "target": "es5",
          "module": "commonjs",
          "moduleResolution": "node",
          "sourceMap": true,
          "emitDecoratorMetadata": true,
          "experimentalDecorators": true,
          "declaration": true,
          "baseUrl": "./ts",
          "outDir": "js"
      },
      "exclude": [
          "node_modules",
          "js"
      ]
  }
  </code></pre>
  
  <p>Any ideas?</p>