Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type '"findUniqueOrThrow"' is not assignable to type 'PrismaAction' #17470

Closed
mejiaej opened this issue Jan 23, 2023 · 2 comments · Fixed by #17471
Closed

Type '"findUniqueOrThrow"' is not assignable to type 'PrismaAction' #17470

mejiaej opened this issue Jan 23, 2023 · 2 comments · Fixed by #17471
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. tech/typescript Issue for tech TypeScript. topic: client types Types in Prisma Client
Milestone

Comments

@mejiaej
Copy link
Contributor

mejiaej commented Jan 23, 2023

Bug description

Hey Guys,

I'm using the Prisma.MiddlewareParams type which contains an attribute action of type PrismaAction. Which is missing a couple of actions that actually exists findUniqueOrThrow and findFirstOrThrow

Because of that we get a ts error when using one of those missing types:
Screen Shot 2023-01-22 at 19 32 25

How to reproduce

Just add this code in a ts file and you'll see the error

  const action : Prisma.PrismaAction = 'findUniqueOrThrow';
  console.log(action);

Expected behavior

There shouldn't be a ts error because those actions do exists.

Prisma information

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "sqlite"
  url      = "file:./dev.db" // env("DATABASE_URL")
}

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
}


model Planet {
  id        Int     @id @default(autoincrement())  
  name      String  
  diameter  String
  gravity   String
  terrain   String
  createdAt DateTime
  updatedAt DateTime?
  deletedAt DateTime?
}
import { Prisma } from '@prisma/client';

  const action : Prisma.PrismaAction = 'findUniqueOrThrow';
  console.log(action);

Environment & setup

  • OS: macOS
  • Database: SQLite
  • Node.js version: v16.14.0

Prisma Version

 "@prisma/client": "^4.7.1",
@mejiaej mejiaej added the kind/bug A reported bug. label Jan 23, 2023
mejiaej pushed a commit to mejiaej/prisma that referenced this issue Jan 23, 2023
mejiaej pushed a commit to mejiaej/prisma that referenced this issue Jan 23, 2023
@tomhoule tomhoule added bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. topic: client types Types in Prisma Client team/client Issue for team Client. tech/typescript Issue for tech TypeScript. labels Jan 24, 2023
@Jolg42 Jolg42 added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. and removed bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. labels Jan 26, 2023
@DoubleJ-G
Copy link

This is still an issue, any plan to add this? It seems like a simple fix in the type definitions

@janpio janpio changed the title Type '"findUniqueOrThrow"' is not assignable to type 'PrismaAction' Type '"findUniqueOrThrow"' is not assignable to type 'PrismaAction' Jun 7, 2023
@shadoath
Copy link

I would second this. I ran into an issue now cause I thought I could count on this type as it said it would be.

aqrln pushed a commit that referenced this issue Jul 20, 2023
* fix(client): add missing actions to PrismaAction type

Closes #17470
@Jolg42 Jolg42 added this to the 5.1.0 milestone Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. tech/typescript Issue for tech TypeScript. topic: client types Types in Prisma Client
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants