JSII中的TypeScript不忽略node_modules

k97glaaz  于 2023-02-08  发布在  Node.js
关注(0)|答案(1)|浏览(183)

我有一个JSII项目,在package.json中包含以下JSII部分:

"jsii": {
    "outdir": "dist",
    "targets": {
      "python": {
        "distName": "pipeline-github-token",
        "module": "pipeline_github_token"
      }
    },
    "tsc": {
      "outDir": "build",
      "rooDir": "src"
    }
  }

构建期间,JSII生成tsconfig.json文件,其中包含以下部分:

"include": [
    "**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "build/**/*.ts"
  ],

但是看起来TypeScript仍然尝试处理node_modules内部的文件,我收到了如下错误

node_modules/jest-snapshot/build/index.d.ts:179:9 - error TS1005: ',' expected.

179   [hint?: string, fromPromise?: boolean]
            ~
node_modules/jest-snapshot/build/index.d.ts:179:30 - error TS1005: ',' expected.

179   [hint?: string, fromPromise?: boolean]
                                 ~
node_modules/jest-snapshot/build/index.d.ts:179:31 - error TS1134: Variable declaration expected.

179   [hint?: string, fromPromise?: boolean]
                                  ~
node_modules/jest-snapshot/build/index.d.ts:179:40 - error TS1005: ',' expected.

179   [hint?: string, fromPromise?: boolean]
                                           ~
node_modules/jest-snapshot/build/index.d.ts:180:1 - error TS1109: Expression expected.

180 >;
    ~
node_modules/jest-snapshot/build/index.d.ts:180:2 - error TS1109: Expression expected.

为什么TypeScript在编译过程中不忽略/排除node_module内容?

g9icjywg

g9icjywg1#

请看以下内容:
https://github.com/aws/jsii/issues/3864
您可能使用了与jsii不兼容的@types/jest版本。当前版本的jsii与旧版本的typescript兼容。

相关问题