const videoInfo: {
id_video: string | undefined;
title: string | undefined;
thumbnails: string | undefined;
publishedAt: string | undefined;
channelId: string | undefined;
viewCount: string | undefined;
commentCount: string;
}
function assertNotPartial<T>(entry: Partial<T>): asserts entry is Required<T> {
if (Object.values(entry).every((value) => value !== undefined)) {
return;
}
throw Error('YOUR ERROR MESSAGE');
}
assertNotPartial(videoInfo);
console.log(videoInfo); // Тут не будет в типе undefined'ов