cannot redeclare block scoped variable (typescript)

后端 未结 8 1202
醉话见心
醉话见心 2020-12-08 18:02

I\'m building a node app, and inside each file in .js used to doing this to require in various packages.

let co = require(\"co\");

But gett

8条回答
  •  我在风中等你
    2020-12-08 18:33

    In my case the following tsconfig.json solved problem:

    {
      "compilerOptions": {
        "esModuleInterop": true,
        "target": "ES2020",
        "moduleResolution": "node"
      }
    }
    

    There should be no type: module in package.json.

提交回复
热议问题