title: TypeScript / Import & Export of modules / classes - Runtime error when running imported class
body: <p>I'm using TypeScript.</p>
  
  <p>I have inside file <strong>String.ts</strong> the following:</p>
  
  <pre><code>module Sgc.Sys {
      "use strict";
      export class String {       
          static trim(input: string): string {
              return input.replace(/^\s+|\s+$/g, "");
          };
  //-- other methods below ...
      }
  }
  </code></pre>
  
  <p>Then in file <strong>Number.ts</strong> (located in the same folder of String.ts) I use the method Sgc.Sys.String.trim() defined above:</p>
  
  <pre><code>module Sgc.Sys {
      "use strict";
      export class Number {
  
      static someMethod(input : string) : string {
              //-- some code
              var str = Sgc.Sys.String.trim(input);
              return str;
  
          };
      }
  }
  </code></pre>
  
  <p>The problem: method trim of Sgc.Sys.String must be defined/called as above to be accepted withou errors by TypeScript; however when at runtime the Sgc.Sys.String is undefined and therefore Sgs.Sys.String.trim(input) fires exception.</p>
  
  <p>What should I to be able to call Sgc.Sys.String.trim from inside Sgc.Sys.Number when both String.ts and Number.ts are in the same folder ..\Sgc\Sys ?</p>
  
  <p>Thanks,
  MG</p>