Type 'UserCreateInput' is not assignable to type '(Without<UserCreateInput>)
See original GitHub issueHello! There was an error that didn’t exist before. Everything worked correctly before I started migrating from Angular v13 → 14.
To do this, I updated…
- Typescript from 4.4.3 (I don’t remember the version.) to 4.7.3
- Node.js from 12.2… to 16.15.1
When i started api app i get this error:
ERROR in libs/users/api/src/lib/services/user.service.ts:61:17
TS2322: Type 'UserUpdateInput' is not assignable to type '(Without<UserUpdateInput, UserUncheckedUpdateInput> & UserUncheckedUpdateInput) | (Without<...> & UserUpdateInput)'.
Type 'UserUpdateInput' is not assignable to type 'Without<UserUncheckedUpdateInput, UserUpdateInput> & UserUpdateInput'.
Type 'import("prisma/src/lib/@generated/prisma-nestjs-graphql/user/user-update.input").UserUpdateInput' is not assignable to type 'import("project/node_modules/.prisma/client/index").Prisma.UserUpdateInput'.
The types of 'products.create' are incompatible between these types.
Type 'ProductCreateWithoutAuthorInput[]' is not assignable to type '(Without<ProductCreateWithoutAuthorInput, ProductUncheckedCreateWithoutAuthorInput> & ProductUncheckedCreateWithoutAuthorInput) | ... 6 more ... | (Without<...> & ProductCreateWithoutAuthorInput[])'.
59 | return this.prisma.user.update({
60 | where: {id},
61 | data
| ^^^^
62 |
63 | })
64 | }
webpack compiled with 5 errors (c73eca68bbd75609)
- Another service that contains a bug. But before updating the packages, requests for this service were also executed correctly.
async updateOneCat(where:CategoryWhereUniqueInput, data: CategoryUpdateInput): Promise<Category> {
return this.prisma.category.update({
where: where,
data: data
})
In general, type incompatibility is observed on different models that I don’t use yet. More details in the attached bug-report.odt.
Configuration in schema.prisma:
generator client {
provider = "prisma-client-js"
previewFeatures = ["fullTextIndex", "extendedIndexes"]
}
generator nestgraphql {
provider = "node node_modules/prisma-nestjs-graphql"
output = "../libs/data-access/prisma/src/lib/@generated/prisma-nestjs-graphql"
useInputType_WhereInput_ALL = "WhereInput"
fields_Validator_from = "class-validator"
fields_Validator_input = true
}
datasource db {
provider = "mongodb"
url = env("MONGODB_URI")
}
Examples of models of their schema:
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
ID Int? @unique
email String @unique
hash String?
hashedRt String?
phone String? @unique
firstName String?
secondName String?
lastName String?
role Role @default(USER)
isAdmin Boolean @default(false)
products Product[] @relation("ProductAuthor") //1:n
shops Shop[] //1:n
addressFrom AddressFrom[]
account_id String? @unique @db.ObjectId
account Account? @relation(fields: [account_id], references: [id])
registerdAt DateTime @default(now())
updatedAt DateTime? @updatedAt
}
model Category {
id String @id @default(auto()) @map("_id") @db.ObjectId
ID Int?
name String
blueprints Blueprint[]
color String?
icon String?
image String?
productId String? @unique @db.ObjectId
products Product? @relation("productCategory", fields: [productId], references: [id])
createdAt DateTime? @default(now())
updatedAt DateTime? @updatedAt
}
Environment “@prisma/client”: “3.14.0”, “prisma”: “3.14.0”, “prisma-nestjs-graphql”: “16.0.1”, “@nestjs/common”: “^8.0.0”, “@nestjs/core”: “^8.0.0”, “@nestjs/graphql”: “^10.0.8”, “typescript”: “4.7.3”
I really appreciate your help in solving this problem 🙏 .
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Why do I have to set properties that have defaults ... - GitHub
However, I get this error: Type '{ name: string; email: string; password: string; }' is not assignable to type '(Without<UserCreateInput, ...
Read more >apollo - Am getting 'Variable '$data' expected value of type ...
The createUser method of Prisma client needs a single object arguments, which then contains the different objects required by Prisma.
Read more >prisma is not assignable to never typescript - You.com
I'm getting a type error when trying to create a course using a schema with many to many relationships. In student.ts whenever I...
Read more >Operating against partial structures of your model types - Prisma
As a solution, you can customize the generated model type using Prisma Client's helper types. The User type only contains the model's scalar...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I got rid of the “TS2321: Excessive stack depth comparing types” error the way you suggested, but only on Typescript 4.4.3. Run without errors.
On version 4.7.3 - error TS2321 pops up again and is no longer solved by editing “targetDepth = 200” in tsc.js. + With the update of the TS version, another error is added "TS2322: Type ‘ModelnameCreateInput’ is not assignable to type '(Without<ModelnameCreateInput).
Rollback to version TS 4.6.2 - doesn’t solve the above errors.
On version TS 4.4.3 - api with prisma-nestjs-graphql runs without errors. I’m left here without typed forms on Angular 14. 😢
Tell me) At the basis of the TS2322 and TS2321 errors is the same problem that has not been solved since 2019? Is there any other way to bring this issue to the attention of the typescript team?)
4.4.3 worked for me thx