#Property does not exist on type..but it clearly does.

3 messages · Page 1 of 1 (latest)

lament kraken
#
   
const lastIdResult = prisma.descriptionDiff.findFirst({
        where: {
            packageId: thisPackage.id
        },
        orderBy: {
            createdAt: 'desc'
        }
    });

    // need to check if this result is null or not
    if (lastIdResult) {
        if (lastIdResult.id === thisPackage.last_diff_id) {
            return false
        } 
    }

The model:


model DescriptionDiff {
  id       String @id @default(cuid())
  changes  Json   // Stores the entire diff result as a JSON object
  createdAt DateTime @default(now())
  packageId String
  package   FVTTPackage @relation(fields: [packageId], references: [id])
}

in the inner if statement i am getting a typescript error. Property 'id' does not exist on type (see screenshot)

It does exist, the hover over shows it exists. I'm so confused

i've upgraded typescript, restarted it, re-generated prisma client, reinstalled all node modules, restarted vs code, restarted computer. tried to cast (lastIdResult as DescriptionDiff).id

none of it works, keeps telling me it does not exist, while showing me that it does.

Any help is appreciated.

#

sigh i forgot to add await. i'm leaving this here for other people who have brain dead moments.

bright iron
#

Don't worry, I lost 3h of my life to scoping in js today