Using OR in connectOrCreate

I want to connect to an image if imageId is defined. If not, I want to connect to an image with a matching fileStorageObjectId. If it is not found I want to create a new image.

        featuredImage: {
          delete: true,
          connectOrCreate: input.featuredImage
            ? {
                where: {
                  OR: [
                    { id: input.featuredImage.imageId },
                    {
                      fileStorageObjectId:
                        input.featuredImage.fileStorageObjectId,
                    },
                  ],
                },
                create: input.featuredImage,
              }
            : undefined,
        },


I get the error: Type '{ OR: ({ id: string | undefined; } | { fileStorageObjectId: string; })[]; }' is missing the following properties from type '{ fileStorageObjectId: string; id: string; entryId: string; }': fileStorageObjectId, id, entryId ts (2322) [511, 11]
Was this page helpful?