【问题标题】:ts-toolbelt giving errors on node_modules. Type alias 'MergeList' circularly references itselfts-toolbelt 在 node_modules 上给出错误。类型别名“MergeList”循环引用自身
【发布时间】:2021-01-15 11:09:11
【问题描述】:

几个月前我创建了一个 Vue JS 应用程序 (vue create <app-name>),在更换计算机后我开始收到以下错误

ERROR in /home/bruno/code/vuejs/rockygym-frontnend/node_modules/ts-toolbelt/out/index.d.ts(4111,10):
4111:10 Type alias 'MergeList' circularly references itself.
    4109 |     @hidden
    4110 |     */
  > 4111 |     type MergeList<O, Path extends List<Key>, O1 extends object, depth extends Depth, I extends Iteration = IterationOf<'0'>> = O extends object ? O extends (infer A)[] ? MergeList<A, Path, O1, depth, I>[] : Pos<I> extends Length<Path> ? OMerge<O, O1, depth> : {
         |          ^
    4112 |         [K in keyof O]: K extends Path[Pos<I>] ? MergeList<O[K], Path, O1, depth, Next<I>> : O[K];
    4113 |     } & {} : O;
    4114 |     /**

您可以找到完整列表here。一开始我以为是 ESLint 问题,但我尝试添加以下条目 .eslintignore

node_modules
public
bin
build
node_modules/ts-toolbelt/out/index.d.ts

但由于某些原因,我在运行 vue-cli-service serve --port 1024 时仍然遇到错误。我真的不知道从现在开始在哪里调试。我现在不是立即寻找解决方案,但至少有一些关于在哪里查看和了解导致此类错误的原因的指导。

tsconfig.json

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "webpack-env",
      "jest"
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": [
    "node_modules/**"
  ],
  "types": [
    "vuetify"
  ]
}

vue.config.js

module.exports = {
  transpileDependencies: [
    'vuetify',
  ],
  pwa: {
    workboxOptions: {
      skipWaiting: true,
    },
  },
};

【问题讨论】:

    标签: angular typescript vue.js eslint


    【解决方案1】:

    更新ts-toolbelt,问题解决。

    如果你使用 npm, &gt;&gt; npm i ts-toolbelt

    如果你使用纱线, &gt;&gt; yarn add ts-toolbelt

    【讨论】:

    • 当我看到你的评论时我有一些希望,但不幸的是仍然遇到同样的错误
    • 这解决了我的角度项目中的问题。我不知道 VueJS 项目的状态如何。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-03
    • 2021-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多