Type instantiation is excessively deep and possibly infinite. при spread
я пытаюсь развернуть свой объект в опцию монгуса update в функции findOneAndUpdate,
но транспилятор выкидывает эксепшен Type instantiation is excessively deep and possibly infinite.
Product.findOneAndUpdate(
{ id: product.id },
{
...product,
productCategoryId: categoryId,
parentGroup: groupId,
},
{ new: true, upsert: true }
)
Интерфейс объекта
interface IProduct<T, U> {
additionalInfo: string,
description: string,
id: string,
code: string,
isDeleted: boolean,
name: string,
differentPricesOn: Array<string | number>,
doNotPrintInCheque: boolean,
measureUnit: MEASURE_UNIT,
modifiers: any[],
price: number,
images: IImage[],
productCategoryId: T,
type: string,
weight: number,
isIncludedInMenu: boolean,
order: number,
parentGroup: U,
warningType: number
}