title: Declare var in typescript from external file gets ReferenceError: ... is not defined
body: <p>I have the following typescript file--></p>
  
  <pre><code>module someModule {
  declare var servicePort: string;
  
  export class someClass{
  constructor(){
    servicePort = servicePort || ""; //ERROR= 'ReferenceError: servicePort is not defined'
  }
  </code></pre>
  
  <p>also tried this on one of functions inside "someClass" --></p>
  
  <pre><code>someFunction = () =&gt; {
      if (servicePort &amp;&amp; servicePort != '') { //ERROR - also servicePort is not defined
              //do something with servicePort 
          }
  }
  </code></pre>
  
  <p>If I define var servicePort somewhere on my js /html files it will work, but not all my pages contains the servicePort var, and I want to safe get the value from that varible without exception.
  What am I doing wrong?</p>