lib.es2015.promise.d.ts(33,34):未提供'值'的参数 [英] lib.es2015.promise.d.ts(33, 34): An argument for 'value' was not provided

查看:12
本文介绍了lib.es2015.promise.d.ts(33,34):未提供'值'的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

                                  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"
  ]
}

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

解析(.参数)更改为解析(参数)

我收到此错误:

类型为‘any[]’的参数不能赋给类型为‘T|PromiseLike’的参数。 类型‘any[]’不可赋值给类型‘T’。 ‘t’可以用与‘any[]’无关的任意类型实例化

还将目标更改为ES6、ES5、es2016、es2015等不起作用

推荐答案

我使用:

解决了这个问题
`resolve(null);`

而不是:

'resolve();`

这篇关于lib.es2015.promise.d.ts(33,34):未提供'值'的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆