簡體   English   中英

aws cdk 2.0 init 應用程序無法構建更漂亮的問題,這來自 jest-snapshot

[英]aws cdk 2.0 init app fails to build with prettier issues, which is from jest-snapshot

節點:v16.7.0
cdk:2.0.0(構建 4b6ce31)

package.json:

  "devDependencies": {
    "@types/jest": "^26.0.10",
    "@types/node": "10.17.27",
    "aws-cdk": "2.0.0",
    "jest": "^26.4.2",
    "ts-jest": "^26.2.0",
    "ts-node": "^9.0.0",
    "typescript": "^3.9.7"
  },
  "dependencies": {
    "aws-cdk-lib": "2.0.0",
    "constructs": "^10.0.0",
    "source-map-support": "^0.5.16"
  }

npm 運行構建/觀察堆棧跟蹤:

node_modules/@types/prettier/index.d.ts:41:54 - error TS2315: Type 'IsTuple' is not generic.

41 type IndexProperties<T extends { length: number }> = IsTuple<T> extends true
                                                        ~~~~~~~~~~

node_modules/@types/prettier/index.d.ts:53:6 - error TS2456: Type alias 'IsTuple' circularly references itself.

53 type IsTuple<T> = T extends [] ? true : T extends [infer First, ...infer Remain] ? IsTuple<Remain> : false;
        ~~~~~~~

node_modules/@types/prettier/index.d.ts:53:65 - error TS2574: A rest element type must be an array type.

53 type IsTuple<T> = T extends [] ? true : T extends [infer First, ...infer Remain] ? IsTuple<Remain> : false;
                                                                   ~~~~~~~~~~~~~~~

node_modules/@types/prettier/index.d.ts:53:84 - error TS2315: Type 'IsTuple' is not generic.

53 type IsTuple<T> = T extends [] ? true : T extends [infer First, ...infer Remain] ? IsTuple<Remain> : false;
                                                                                      ~~~~~~~~~~~~~~~

node_modules/@types/prettier/index.d.ts:96:5 - error TS2589: Type instantiation is excessively deep and possibly infinite.

96     call<
       ~~~~

node_modules/@types/prettier/index.d.ts:131:5 - error TS2589: Type instantiation is excessively deep and possibly infinite.

131     each<
        ~~~~

node_modules/@types/prettier/index.d.ts:165:5 - error TS2589: Type instantiation is excessively deep and possibly infinite.

165     map<
        ~~~

[2:30:13 PM] Found 7 errors. Watching for file changes.

我注意到更漂亮的來自package-lock.json中的jest-snapshot

    "node_modules/jest-snapshot": {
      "version": "26.6.2",
      "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-26.6.2.tgz",
      "integrity": "sha512-OLhxz05EzUtsAmOMzuupt1lHYXCNib0ECyuZ/PZOx9TrZcC8vL0x+DUG3TL+GLX3yHG45e6YGjIm0XwDc3q3og==",
      "dev": true,
      "dependencies": {
        "@babel/types": "^7.0.0",
        "@jest/types": "^26.6.2",
        "@types/babel__traverse": "^7.0.4",
        "@types/prettier": "^2.0.0",
        "chalk": "^4.0.0",
        "expect": "^26.6.2",
        "graceful-fs": "^4.2.4",
        "jest-diff": "^26.6.2",
        "jest-get-type": "^26.3.0",
        "jest-haste-map": "^26.6.2",
        "jest-matcher-utils": "^26.6.2",
        "jest-message-util": "^26.6.2",
        "jest-resolve": "^26.6.2",
        "natural-compare": "^1.4.0",
        "pretty-format": "^26.6.2",
        "semver": "^7.3.2"
      },
      "engines": {
        "node": ">= 10.14.2"
      }
    },

有任何想法嗎?

我時時刻刻都面臨着這個問題,看起來這就是問題https://github.com/aws/aws-cdk/issues/20319

向 Dev 依賴項添加一個更漂亮的固定版本的建議解決方案對我有用。 試試看

{
  "devDependencies": {
    "@types/prettier": "2.6.0"
  }
}

如果您使用 projen 進行腳手架,則更改應該在 projen.js 文件中

devDeps: [
    '@types/prettier@2.6.0'
]

我必須安裝 npm 才能讓它工作:

  npm install @types/prettier@2.6.0

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM