Ошибка :
TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? Type 'Object' is missing the following properties from type 'Movie': id, overview, poster_path, release_date, title
сам ошибка в цикле и отмечена комментарием
interface Resp {
results: Object[],
page: number
}
interface Movie {
adult?: boolean;
backdrop_path?: string,
genre_ids?: Number[],
id: number,
original_language?: "en",
overview: string,
popularity?: number,
poster_path: string,
release_date: string,
title: string,
video?: boolean,
vote_average?: number
}
export async function getDataMovies(api: string) {
const resp = await fetch(api);
const data: Resp = await resp.json();
const {page, results} = data;
const listLength: number = results.length;
const movies: Object[] = [];
for await (const movie of results) {
const {title, overview, id}: Movie = movie; // bug is here
const releaseDate: Resp = movie.release_date;
const posterPath: Resp = movie.poster_path;
movies.push({
title, overview, releaseDate, posterPath, id
});
}
}