title: fs.readFile() or fs.readFileSync() not a function exception but why?
body: <p>I am using the <code>fs</code> module with the following import code</p>
  
  <p><code>import fs = require('fs')</code></p>
  
  <p>The code runs until encountering this exception at the second line of the TypeScript codes below </p>
  
  <pre><code>const filePath = 'data/soylent-uist2010/userSegments.json'
  const seg = fs.readFileSync(filePath, {
    encoding: 'utf8',
  })
  </code></pre>
  
  <p>However, if I supply the <code>path</code> argument of <code>readFileSync</code> as a raw string (as below), it works as normal (value is assigned). </p>
  
  <pre><code>const seg = fs.readFileSync('data/soylent-uist2010/userSegments.json', {
    encoding: 'utf8',
  })
  </code></pre>
  
  <p>The error stack trace is as below,</p>
  
  <pre><code>Viewer.tsx:155 Uncaught (in promise) TypeError: fs.readFileSync is not a function
      at Viewer.&lt;anonymous&gt; (Viewer.tsx:155)
      at step (io.ts:106)
      at Object.next (io.ts:106)
      at io.ts:106
      at new Promise (&lt;anonymous&gt;)
      at __awaiter (io.ts:106)
      at Viewer._this.loadFiles (Viewer.tsx:135)
      at Viewer.&lt;anonymous&gt; (Viewer.tsx:98)
      at step (io.ts:106)
      at Object.next (io.ts:106)
  </code></pre>
  
  <p>A longer code snippet is as below. I suspect if the <code>async</code> keyword (in the class method) would require an <code>await</code> keyword before <code>fs.readFile()</code></p>
  
  <pre><code>  loadFiles = async () =&gt; {
      this.setState({ pages: [] });
      const {
        pageNumbersToLoad,
        pathInfo: { pdfDir, pdfRootDir }
      } = this.props;
      const fullDirPath = path.join(pdfRootDir, pdfDir);
      const pdfPath = path.join(fullDirPath, pdfDir + ".pdf");
      **const seg = fs.readFile(...);**
  </code></pre>