ts-node ignores d.ts files while tsc successfully compiles the project

前端 未结 4 587
伪装坚强ぢ
伪装坚强ぢ 2021-02-03 17:20

Having compiled my TypeScript project successfully, I intended to run it in VS Code\'s debug mode using ts-node. Problem is, ts-node can\'t find

4条回答
  •  抹茶落季
    2021-02-03 17:51

    I was having a similar problem, but I could not add --files, because I run ts-node by registering the module through mocha (i.e. mocha -r ts-node/register ...).

    I could solve it by adding a files and a ts-node section to tsconfig.json like this:

    // tsconfig.json
    {
      "ts-node": {
        "files": true
      },
      "files": [
        "src/index.ts",
        "src/global.d.ts"
      ],
      "compilerOptions":{
        //...
      }
    }
    

    I hope somebody will find this useful.

提交回复
热议问题