title: TypeScript: __dirname value?
body: <p>My folder structure is like this:</p>
  <pre><code>app
  └─ tsFolder
     └─ XX.ts
  </code></pre>
  <p>Code in <code>XX.ts</code> file:</p>
  <pre class="lang-js prettyprint-override"><code>var __dirname: string;
  console.log(&quot;__dirname: &quot; + __dirname); // the output is undefined.
  </code></pre>
  <p>I have tried it: by comment out the code <code>var __dirname: string;</code>, the value of <code>__dirname</code> is: <code>...../app</code> insead of pointing to the current folder like <code>...../app/tsFolder</code>.</p>
  <p>Can anyone explain it?</p>