Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

types are broken #23999

Closed
FullmetalBober opened this issue Apr 27, 2024 · 0 comments
Closed

types are broken #23999

FullmetalBober opened this issue Apr 27, 2024 · 0 comments
Labels
kind/bug A reported bug.

Comments

@FullmetalBober
Copy link

FullmetalBober commented Apr 27, 2024

Bug description

After importing
import { Prisma } from '@prisma/client';
and using model with enums
async function onSubmit(data: Prisma.IssueUncheckedCreateInput) {
my typescript stopped work, I no longer get type highlighting and errors

image
https://github.com/FullmetalBober/ProgressHub/blob/main/components/issues/CreateIssueModal.tsx#L46

How to reproduce

Expected behavior

No response

Prisma information

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

generator zod {
  provider                  = "zod-prisma-types"
  output                    = "./zod"
  createRelationValuesTypes = true
  useTypeAssertions         = true
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

/// @zod.strip()
model Account {
  id                String  @id @default(cuid())
  userId            String
  type              String
  provider          String
  providerAccountId String
  refresh_token     String? @db.Text
  access_token      String? @db.Text
  expires_at        Int?
  token_type        String?
  scope             String?
  id_token          String? @db.Text
  session_state     String?

  user User @relation(fields: [userId], references: [id], onDelete: Cascade)

  @@unique([provider, providerAccountId])
}

/// @zod.strip()
model Session {
  id           String   @id @default(cuid())
  sessionToken String   @unique
  userId       String
  expires      DateTime
  user         User     @relation(fields: [userId], references: [id], onDelete: Cascade)
}

/// @zod.strip()
model User {
  id            String             @id @default(cuid())
  /// @zod.string.trim().min(1).max(255)
  name          String?
  /// @zod.string.trim().min(1).max(255)
  email         String?            @unique
  emailVerified DateTime?
  image         String?
  accounts      Account[]
  sessions      Session[]
  workspaces    WorkspaceMembers[]
  issues        Issue[]
}

/// @zod.strip()
model Workspace {
  id      String             @id @default(cuid())
  /// @zod.string.trim().min(1).max(255)
  name    String             @unique
  image   String?
  members WorkspaceMembers[]
  issues  Issue[]
}

enum Role {
  OWNER
  ADMIN
  MEMBER
}

/// @zod.strip()
model WorkspaceMembers {
  id          String    @id @default(cuid())
  role        Role
  userId      String
  workspaceId String
  user        User      @relation(fields: [userId], references: [id])
  workspace   Workspace @relation(fields: [workspaceId], references: [id])
  createdAt   DateTime  @default(now())
}

enum Status {
  BACKLOG
  TODO
  IN_PROGRESS
  DONE
  CANCELED
}

enum Priority {
  NO_PRIORITY
  URGENT
  HIGH
  MEDIUM
  LOW
}

/// @zod.strip()
model Issue {
  id          String    @id @default(cuid())
  /// @zod.string.trim().min(1).max(255)
  title       String
  /// @zod.string.trim().min(1).max(255)
  description String    @default("")
  status      Status    @default(BACKLOG)
  priority    Priority  @default(NO_PRIORITY)
  workspaceId String
  workspace   Workspace @relation(fields: [workspaceId], references: [id])
  assigneeId  String
  assignee    User      @relation(fields: [assigneeId], references: [id])
  comments    Comment[]
  createdAt   DateTime  @default(now())
  updatedAt   DateTime  @updatedAt
}

/// @zod.strip()
model Comment {
  id        String   @id @default(cuid())
  /// @zod.string.trim().min(1).max(255)
  body      String
  issueId   String
  issue     Issue    @relation(fields: [issueId], references: [id])
  authorId  String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}
// Add your code using Prisma Client

Environment & setup

  • OS: Windows
  • Database: PostgreSQL
  • Node.js version: v20.7.0
  • Typescript version: 5.4.5

Prisma Version

prisma                  : 5.13.0
@prisma/client          : 5.13.0
Computed binaryTarget   : windows
Operating System        : win32
Architecture            : x64
Node.js                 : v20.7.0
Query Engine (Node-API) : libquery-engine b9a39a7ee606c28e3455d0fd60e78c3ba82b1a2b (at node_modules\.pnpm\@prisma+engines@5.13.0\node_modules\@prisma\engines\query_engine-windows.dll.node)
Schema Engine           : schema-engine-cli b9a39a7ee606c28e3455d0fd60e78c3ba82b1a2b (at node_modules\.pnpm\@prisma+engines@5.13.0\node_modules\@prisma\engines\schema-engine-windows.exe)
Schema Wasm             : @prisma/prisma-schema-wasm 5.13.0-23.b9a39a7ee606c28e3455d0fd60e78c3ba82b1a2b
Default Engines Hash    : b9a39a7ee606c28e3455d0fd60e78c3ba82b1a2b
Studio                  : 0.500.0
@FullmetalBober FullmetalBober added the kind/bug A reported bug. label Apr 27, 2024
@prisma prisma locked and limited conversation to collaborators Apr 29, 2024
@janpio janpio converted this issue into discussion #24007 Apr 29, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
kind/bug A reported bug.
Projects
None yet
Development

No branches or pull requests

1 participant