title: Typescript Express server giving "Cannot use import statement outside of module"
body: <p>Typescript 3.8 introduced top level await functionality. This is great for me! I enable it by setting the <code>module</code> and <code>moduleResolution</code> settings in <code>tsconfig</code> to <code>ESNext</code> and <code>node</code> respectively.</p>
  <p>Suddenly a problem though, my application no longer boots. Instead throwing an error:</p>
  <pre><code>SyntaxError: Cannot use import statement outside a module`
  </code></pre>
  <p>Looking over my code I know exactly where its throwing the error, but not sure how to fix it. I've added <code>type:module</code> to my <code>package.json</code>, but still not getting anything to work.</p>
  <p>Here is a look at how my <code>boot.ts</code> entry file looks. Under the hood we're starting an express server.</p>
  <pre><code>import { Server } from &quot;./api/server&quot;;
  import {Storage} from &quot;./boot_storage&quot;;
  import BackedLogger from &quot;./logger/logger&quot;;
  
  
  const storage = new Storage();
  
  storage.boot()
      .then(() =&gt; {
          Server.Instance.startServer(BackedLogger)
      });
  
  </code></pre>
  <p>I know this isn't a ton to go on. I still don't understand imports in Typescript/Node well. I'm more than willing to answer questions and give clarification.</p>
  <p><strong>I'm more than willing to change how my application starts in order to get this to work, that's how nice the top level async/await is going to be for me.</strong></p>