Prisma nested write issue

I get a TS error (and failing query) when trying to execute this nested write.

model Applicant {
  id           String        @id @default(uuid()) @db.Uuid
  email        String        @unique
  applications Application[]

  @@map("applicants")
}

model Application {
  id          String     @id @default(uuid()) @db.Uuid
  name        String
  applicant   Applicant? @relation(fields: [applicantId], references: [id])
  applicantId String?    @map("applicant_id") @db.Uuid

  @@index([applicantId])
  @@map("applications")
}


prisma.application.create({
    data: { // Types of property 'name' are incompatible. Type 'string' is not assignable to type 'undefined'
      name: "whatever",
      applicant: {
        create: {
          email: "some@email.com",
        },
      },
    },
  })


What is going on here? Why is this not a valid nested write?

When executing the error throws: Unknown arg "applicant" in data.applicant for type ApplicationUncheckedCreateInput.
Was this page helpful?