Skip to content

Update does not enforce type on data #9988

Closed as not planned
Closed as not planned

Description

@austincrim

Discussed in #9957

Originally posted by GuiSim October 26, 2021
Hello!

I'm new to Prisma and testing it out. I encountered an issue today where an update statement would not raise any type issue on an invalid data object.

prisma.mything.update({
  where: { id: '1' },
  data: { invalidField: 42 }, // Does not compile as `invalidField` is not a valid field on `mything`
});

const data = { invalidField: 42 };
prisma.mything.update({
  where: { id: '1' },
  data: data, // Compiles without issues. Why?
});

Can you help me understand why?

Activity

  1. added
    bug/0-unknown
    kind/bug
    tech/typescript
    topic: client types
    on Nov 8, 2021
  2. added
    bug/1-unconfirmed
    and removed
    bug/0-unknown
    on Jun 2, 2022
  3. Jolg42 commented on Feb 16, 2024

    @Jolg42
    Contributor

    Closing as duplicate, see #22445 which was reproduced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/1-unconfirmedkind/bugtech/typescripttopic: client types

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions