gpt4 book ai didi

typescript - lib.es2015.promise.d.ts(33, 34) : An argument for 'value' was not provided

转载 作者:行者123 更新时间:2023-12-05 09:35:36 24 4
gpt4 key购买 nike

                                  22:16:16:25

TS2556:需要 1 个参数,但得到 0 个或更多。

           config.promise.then((...args: any[]) => {
if (this._isCancelled) return;
this._isCompleted = true;
resolve(...args);
^^^^^^^
}, (error)=>{
if (this._isCancelled) return;
this._isCompleted = false;
reject(error);
});

tsconfig.json

{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"lib": [
"ESNext",
"ESNext.AsyncIterable",
"DOM"
],
"esModuleInterop": true,
"paths": {
"~/*": [
"./*"
],
"@/*": [
"./*"
]
},
"types": [
"@types/node",
"@nuxtjs/axios",
"@nuxt/types",
"types-lib/*"
]
},
"exclude": [
"node_modules"
]
}

代码运行得更好,但文件中出现错误

After changing from resolve(...args) to resolve(args)

我收到这个错误:

类型“any[]”的参数不可分配给类型“T |”的参数PromiseLike'。类型“any[]”不可分配给类型“T”。“T”可以用与“any[]”无关的任意类型实例化

也将目标更改为 es6、es5、es2016、es2015 等无效

最佳答案

我通过使用解决了这个问题:

`resolve(null);`

代替:

'resolve();`

关于typescript - lib.es2015.promise.d.ts(33, 34) : An argument for 'value' was not provided,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65763534/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com