title: IIFE functions in typescript
body: <p>I found this article, <a href="http://blog.mgechev.com/2012/08/29/self-invoking-functions-in-javascript-or-immediately-invoked-function-expression/" rel="nofollow noreferrer">self-invoking function in JavaScript</a> by Minko Gechev, teaching us how to write a JavaScript function that calls itself right after being initialized. I wonder how we can do this in typescript. <strong>I found if I write the code inside <code>export class ComponentName</code>, it will not work. 
  the code I tried:</strong></p>
  
  <pre><code>import {Component, Input} from '@angular/core'
  
  @Component({...})
  
  export class MyComponent{
  
      @Input() infoes;
  
      (function(){
          console.log('testing');
      })();
  }
  </code></pre>
  
  <p>The error the IDE was showing is <code>unexpected token. a constructor, accessor, method or property was expected</code> . I think it has to do with the class concept TypeScript introduced.</p>