问题描述
几个月前,我已经创建了一个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,depth> : {
| ^
4112 | [K in keyof O]: K extends Path[Pos<I>] ? MergeList<O[K],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,},};
解决方法
更新ts-toolbelt解决了该问题。
如果您使用的是npm,
>> npm i ts-toolbelt
如果您使用纱线,
>> yarn add ts-toolbelt