Below is the code snippet that I am working with:
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;
}
The structure of iFlower
is defined as follows:
export interface iFlower {
color: string;
number: string;
}
When attempting to run the code, the following errors are encountered:
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.
Could these errors stem from using iFlower
as an interface?