title: Angular 6 with plain TypeScript - ERROR: module has no exported member
body: <p>I have a small Angular 6 library in which I am building a reusable component to display page-level messages, such as error, info, warning, and success.</p>
  
  <p>For this I have an enum <code>ServerMessageType.ts</code>, which is simple enough:</p>
  
  <pre><code>export enum ServerMessageType {
      Error = 'error',
      Info = 'info',
      Success = 'success',
      Warning = 'warning'
  }
  </code></pre>
  
  <p><code>ServerMessage.ts</code> should use <code>ServerMessageType</code>:</p>
  
  <pre><code>import { ServerMessageType } from './ServerMessageType';
  
  export class ServerMessage {
      constructor(public type: ServerMessageType, 
                  public messageText: string, 
                  public dismissible?: boolean, 
                  public id?: string) {
      }
  }
  </code></pre>
  
  <p><code>server-messages.component.ts</code></p>
  
  <pre><code>import { Component, EventEmitter, Input, Output } from '@angular/core';
  
  import { ServerMessage } from './ServerMessage';
  import { ServerMessageType } from './ServerMessageType';
  
      @Component({
    selector: 'app-server-messages',
    templateUrl: './server-messages.component.html',
    styleUrls: []
  })
  export class ServerMessagesComponent {
  
    @Input() messages: ServerMessage[];
    @Output() messageRemoved = new EventEmitter&lt;ServerMessage&gt;();
  
    constructor() {
    }
  
    clearMessage = function (index: number) {
      const message = this.messages[ index ];
  
      this.messageRemoved.emit(message);
      this.messages.splice(index, 1);
    };
  
    getMessageClass(message: ServerMessage): string {
      switch (message.type) {
        case ServerMessageType.Error:
          return 'alert-danger';
        case ServerMessageType.Info:
          return 'alert-info';
        case ServerMessageType.Success:
          return 'alert-success';
        case ServerMessageType.Warning:
          return 'alert-warning';
      }
    }
  
    isDismissible(message: ServerMessage): boolean {
      return message.dismissible === true;
    }
  }
  </code></pre>
  
  <p>However, when I run <code>ng build</code>, I get an error:</p>
  
  <pre><code>BUILD ERROR  
  &gt; projects/framework/src/lib/server-messages/server-messages.component.ts(3,28):
  &gt; error TS2305: Module
  &gt; '"/Users/xxx/dev/apps/framework/projects/framework/src/lib/server-messages/ServerMessage"'
  &gt; has no exported member 'ServerMessageType'
  </code></pre>
  
  <p>What am I doing wrong? If I change <code>type</code> in <code>ServerMessage</code> to be a string and remove the <code>ServerMessageType</code> enum altogether, things build and deploy just fine.</p>
  
  <p>Thanks!</p>