Hi, firstly, fantastic project, and thank you for your contributions!
With a default setup from the readme in this repo, there is a type error for the createOnePost / updateOnePost / upsertOnePost mutations in Post.router.ts - seemingly a conflict between the Zod Schemas + Prisma input types that are expected.
Dump of error from TS for createOnePost:
Argument of type '{ data: (PostCreateInput | PostUncheckedCreateInput) & (PostCreateInput | PostUncheckedCreateInput | undefined); }' is not assignable to parameter of type '{ select?: PostSelect | null | undefined; include?: PostInclude | null | undefined; data: (Without<PostCreateInput, PostUncheckedCreateInput> & PostUncheckedCreateInput) | (Without<...> & PostCreateInput); }'.
Types of property 'data' are incompatible.
Type '(PostCreateInput | PostUncheckedCreateInput) & (PostCreateInput | PostUncheckedCreateInput | undefined)' is not assignable to type '(Without<PostCreateInput, PostUncheckedCreateInput> & PostUncheckedCreateInput) | (Without<...> & PostCreateInput)'.
Type 'PostCreateInput & PostUncheckedCreateInput' is not assignable to type '(Without<PostCreateInput, PostUncheckedCreateInput> & PostUncheckedCreateInput) | (Without<...> & PostCreateInput)'.
Type 'PostCreateInput & PostUncheckedCreateInput' is not assignable to type 'Without<PostUncheckedCreateInput, PostCreateInput> & PostCreateInput'.
Type 'PostCreateInput & PostUncheckedCreateInput' is not assignable to type 'Without<PostUncheckedCreateInput, PostCreateInput>'.
Types of property 'id' are incompatible.
Type 'number | undefined' is not assignable to type 'undefined'.
Type 'number' is not assignable to type 'undefined'.ts(2345)
This happens in my turbo-repo setup, but I made a clean project to sanity check and the same error occurs.
Follow this repos quickstart (adding package + prisma models for user + post in readme, install zod)
Prisma Generate
Note type errors for createOne, updateOne, upsertOne actions
Expected behavior
No type errors preventing TS builds
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 = env("DATABASE_URL")
}
generator trpc {
provider = "prisma-trpc-generator"
withZod = true
withMiddleware = false
withShield = false
contextPath = "../context"
trpcOptionsPath = "../trpcOptions"
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}
model Post {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String
content String?
published Boolean @default(false)
viewCount Int @default(0)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}
Bug description
Hi, firstly, fantastic project, and thank you for your contributions!
With a default setup from the readme in this repo, there is a type error for the
createOnePost
/updateOnePost
/upsertOnePost
mutations inPost.router.ts
- seemingly a conflict between the Zod Schemas + Prisma input types that are expected.Dump of error from TS for
createOnePost
:This happens in my turbo-repo setup, but I made a clean project to sanity check and the same error occurs.
Let me know how I can help, if possible.
How to reproduce
Expected behavior
No type errors preventing TS builds
Prisma information
Environment & setup
Prisma Version