title: TypeScript: can only be default-imported using the 'esModuleInterop' flag
body: <p>I've the following <code>index.ts</code>:</p>
  <pre><code>import { User } from &quot;./datatypes&quot;
  import express from 'express';
  
   console.log(&quot;hello world&quot;)
  </code></pre>
  <p>This is my <code>package.json</code>:</p>
  <pre><code>{
    &quot;name&quot;: &quot;simple_app&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;description&quot;: &quot;&quot;,
    &quot;main&quot;: &quot;index.js&quot;,
    &quot;scripts&quot;: {
      &quot;start&quot;: &quot;tsc index.ts &amp;&amp; node index.js&quot;
    },
    &quot;keywords&quot;: [],
    &quot;author&quot;: &quot;&quot;,
    &quot;license&quot;: &quot;ISC&quot;,
    &quot;dependencies&quot;: {
      &quot;dotenv&quot;: &quot;^16.0.0&quot;,
      &quot;express&quot;: &quot;^4.17.3&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@types/express&quot;: &quot;^4.17.13&quot;,
      &quot;@types/node&quot;: &quot;^17.0.23&quot;,
      &quot;ts-node&quot;: &quot;^10.7.0&quot;,
      &quot;typescript&quot;: &quot;^4.6.3&quot;
    }
  }
  </code></pre>
  <p>And this is my tsconfig.json:</p>
  <pre><code>{
      &quot;compilerOptions&quot;: {
        &quot;module&quot;: &quot;commonjs&quot;,
        &quot;esModuleInterop&quot;: true,
        &quot;resolveJsonModule&quot;: true,
        &quot;target&quot;: &quot;es6&quot;,
        &quot;moduleResolution&quot;: &quot;node&quot;,
        &quot;sourceMap&quot;: true,
        &quot;outDir&quot;: &quot;dist&quot;
      },
      &quot;lib&quot;: [&quot;es2015&quot;]
    }
  </code></pre>
  <p>When I write <code>npm run start</code>, I obtain:</p>
  <pre><code> Module '&quot;/mnt/c/Users/raffa/Desktop/simple_app/node_modules/@types/express/index&quot;' can only be default-imported using the 'esModuleInterop' flag
  
  2 import express from 'express';
           ~~~~~~~
  
    node_modules/@types/express/index.d.ts:133:1
      133 export = e;
          ~~~~~~~~~~~
      This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
  </code></pre>
  <p>How can I solve this problem?</p>