【发布时间】:2019-11-06 13:06:36
【问题描述】:
我有下一段代码:
public async insert(data: iFlower | iFlower[]): Promise<iFlower> | Promise<iFlower[]> {
await this.insert(data);
}
private async insert(data: iFlower): Promise<iFlower>{
....
return data;
}
private async insert(data: iFlower[]): Promise<iFlower[]> {
....
return data;
}
iFlower 是:
export interface iFlower {
color: string;
number: string;
}
我收到以下错误:
The return type of an async function or method must be the global Promise<T> type.
Duplicate function implementation.
'insert' is declared but its value is never read.
是不是因为iFlower是一个接口?
【问题讨论】: