[英]TS2554: Expected 0 arguments, but got 2
Here is a modified version of the code that I have.这是我拥有的代码的修改版本。
return await this.X.y(
a,
b,
);
and the function y looks like this:函数 y 如下所示:
async y(
a: string,
b: B,
) {
return await this.foo.put(
`${this.config.foobar}/foo/${a}`,
b,
);
and I have been getting the error stated above.我一直收到上述错误。 How is it possible for the function to expect 0 arguments when it has 2 specified with it?
当函数指定了 2 个参数时,它怎么可能期望 0 个参数?
There is obvious conflicts on the expected function being ran.正在运行的预期功能存在明显冲突。 Without no more code to see is difficult to be precise but from that example you gave, my wild guess is that either:
如果没有更多的代码可以看到很难准确,但从你给出的那个例子来看,我疯狂的猜测是:
this.foo.put()
function does really takes no arguments this.foo.put()
函数确实没有参数Try to debug and get what is the prototype of this.foo
and check again the function put()
prototype also.尝试调试并获取
this.foo
的原型并再次检查函数put()
原型。 I strongly think your line of thought scope is not the same of the running program, it is all about scope ;)我强烈认为您的思路范围与正在运行的程序不同,这完全与范围有关;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.