我具有此功能,但是在编译应用程序时。
public async test(options?: { engine?: Config }): Promise<any> {
const hostel = new Service({
list: this.servicesList,
createService: list => this.dbService.buildService(list)
});
return hostel.load();
}
我有此错误:
26:27 error Missing return type on function
@typescript-eslint/explicit-function-return-type.
在此行createService: list => this.dbService.buildService(list) text**
答案 0 :(得分:1)
正如安德鲁(Andrew)在评论中提到的那样,您没有从函数中返回任何内容。如果您期望的那样,只需将Promise<any>
更改为Promise<void>
答案 1 :(得分:0)
您只应在函数中添加return
public async test(options?: { engine?: Config }): Promise<any> {
const hostel = new Service({
list: this.servicesList,
createService: list => this.dbService.buildService(list)
});
return hostel;// Missing line
}