я написал код который из сервера может получить 2 типа массива но я получаю ошибку 23.25 lines I get two Errors The 'title' property does not exist for the type and the type argument,Я ожидаю, что строки 23 типа faceProductList [] и 25 типа faceProductList [] [] код
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))
}else{
return [].concat(...array)
}
})
}
}