title: Angular2 Error: Return type of public method from exported class has or is using private name
body: <p>I am building out an Angular 2 app using the Angular-CLI, after initially building a working version of the app using the non-CLI version of Angular 2. To my surprise, some code that wasn't a problem in my non-CLI app version HAS been a problem with my Angular-CLI version. All that said, I've resolved everything except for one final error I am stuck on.</p>
  
  <p>This is the error message I'm getting:</p>
  
  <blockquote>
    <p>Uncaught Error: Module build failed: Error:
    /Users/fdr/Documents/rds/rds/cli-rds/src/app/ui/generate-field.component.ts
    (340,48): Return type of public method from exported class has or is
    using private name 'Hint'.)</p>
  </blockquote>
  
  <p>And here is the problem file causing the error:</p>
  
  <pre><code>import { Component, Input, Output, EventEmitter, OnInit, AfterViewInit, ElementRef, ViewChild } from '@angular/core';
  import { EventHandler } from '../app.event-handler';
  import  '../app.utils';
  
  @Component({
      selector: 'app-generate-field',
      templateUrl: 'app/ui/generate-field.component.html',
      styleUrls: ['app/ui/generate-field.component.css']
  
  })
  export class GenerateField extends EventHandler
  {
  
      public get hasFocus(): boolean
      {
          return this._hasFocus;
      }
  
      @Input() delay: number = 300;
  
  
      @ViewChild('inputField') private inputField: ElementRef;
  
  
      @ViewChild('suggestionField') private suggestionField: ElementRef;
  
  
      @Input() public value: string;
  
  
      @Output() private valueChange: EventEmitter&lt;string&gt; = new EventEmitter&lt;string&gt;();
  
  
      @Output() public keyup: EventEmitter&lt;KeyboardEvent&gt; = new EventEmitter&lt;KeyboardEvent&gt;();
  
      @Output() public focus = new EventEmitter&lt;KeyboardEvent&gt;();
  
      @Output() public blur = new EventEmitter&lt;KeyboardEvent&gt;();
  
      private inlineSuggestion: string;
  
      private suggestions: ISuggestion[];
  
      @Input() public options: string[];
  
      @Output() private optionsChange: EventEmitter&lt;string[]&gt; = new EventEmitter&lt;string[]&gt;();
  
      private isDirty: boolean = false;
  
      private _hasFocus: boolean = false;
  
  
      constructor(myElement: ElementRef)
      {
          super();
  
  
          this.defineObservableProperty('value');
          this.defineObservableProperty('isDirty');
          this.defineObservableProperty('suggestions');
          this.defineObservableProperty('options');
  
          this.addPropertyListener('isDirty', function ()
          {
              if (this.isDirty == false)return;
  
              var delay = this.delay ? this.delay : 500;
  
              var self = this;
  
              setTimeout(function ()
              {
                  self.updateSuggestions();
  
                  this.isDirty = false;
  
              }.bind(this), delay);
  
          }.bind(this));
  
          this.addPropertyListener('value', (): void=&gt;
          {
              this.valueChange.emit(this.value);
  
              this.isDirty = true;
          });
  
          this.addPropertyListener('suggestions', (): void=&gt;
          {
              this.updateInlineSuggestion();
          });
  
          this.addPropertyListener('options', ()=&gt;
          {
              this.optionsChange.emit(this.options);
          });
  
      }
  
      //--------------------------------------------------------
      // Functions
      //--------------------------------------------------------
  
      /**
       * Evaluates value and updates the list of suggestions
       */
      public updateSuggestions(): void
      {
          // Update suggestions
          this.suggestions = this.generateSuggestions(this.value);
      }
  
      /***
       * Updates the inline suggestion that appears on the text field
       */
      private updateInlineSuggestion(): void
      {
          // Clear inline if there are no suggestions
          if (this.suggestions.length == 0)
          {
              this.inlineSuggestion = '';
              return;
          }
  
          // Show first option inline
          this.inlineSuggestion = this.suggestions[0].value;
  
          var x = this.inputField.nativeElement.selectionStart;
          var y = this.inputField.nativeElement.selectionEnd;
  
          this.suggestionField.nativeElement.selectionStart = x;
          this.suggestionField.nativeElement.selectionEnd = y;
  
          this.inputField.nativeElement.selectionStart = x;
          this.inputField.nativeElement.selectionEnd = y;
  
          this.suggestionField.nativeElement.scrollLeft = x;
  
      }
  
      private onFocus(): void
      {
          this._hasFocus = true;
  
          // Forward event
          this.focus.emit();
      }
  
      private onBlur(): void
      {
          this._hasFocus = false;
  
          // Forward event
          this.blur.emit();
      }
  
  
  interface ISuggestion
  {
  
      word: string;
  
      match: string;
  
      value: string;
  }
  </code></pre>