gpt4 book ai didi

typescript - 提供的参数与调用目标的任何签名都不匹配

转载 作者:太空狗 更新时间:2023-10-29 18:34:49 27 4
gpt4 key购买 nike

当我在方法中使用参数装饰器时出现此构建错误。该类实现了一个接口(interface)。下面是接口(interface)和类:

export interface IClient{
getServerConfig(): Observable<Response> ;

getDashboard(): Observable<Response>;

deploy(channelId: string): Observable<Response>;
}

export class Client implements IClient {

public constructor( @Inject(Http) private http: Http, @Inject(Model) private config: Model) {
super(http, config);
}

public getServerConfig(): Observable<Response> {
return null;
}

public getDashboard(): Observable<Response> {
return null;
}

public deploy(@Body('param') channelId: string): Observable<Response> {
return null;
}
}

构建时出现此错误

Supplied parameters do not match any signature of call target.

就在部署函数处。

问题似乎是 channelId 参数旁边的参数装饰器。现在我不能在需要时删除它,所以我想知道是否有办法保留接口(interface)定义和装饰器。接口(interface)中不允许使用装饰器,因此这不是一种选择。

有什么想法吗?

最佳答案

Supplied parameters do not match any signature of call target.

最快的解决方法是执行 const BodyAny:any = Body 并使用 BodyAny。否则修复 Body 的类型定义。

关于typescript - 提供的参数与调用目标的任何签名都不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35642053/

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