After analyzing 23 lines of code, I encountered an issue with the message 'Property 'title' does not exist on type 'faceProductList | faceProductList[]'. How can this error be resolved?
interface faceProductList {
readonly title: string;
readonly price: string;
readonly prodState: string;
readonly shipping: string;
readonly sold: string;
readonly src: string;
readonly id: string;
readonly to: string;
}
class Server {
private url: string = 'https://foo0022.firebaseio.com/';
public async request(id: string): Promise<(faceProductList[] | faceProductList)[]> {
const res = await fetch(`${this.url}${id}`);
const resArr: (faceProductList[] | faceProductList)[] = await res.json();
return resArr;
}
public async handler(id: string, valueSearch: string) {
await this.request(id)
.then((array) => {
if(id){
return array.filter(({title}) => title.includes(valueSearch))
}
})
}
}