prisma-nestjs-graphql: XXXUpdateWithoutYYY is not assignable to Prisma.XXXUpdateWithoutYYY
First, thank you for that awesome library! I love it!
Second: For some Entities I see “Problems” in the VSCode Problems-Panel. I’m glad it compiles without errors, but… did anyone else have similar problems like I do (see beneath)? I
I can try to set up a minimal reproducable example next week if the problem isn’t clear enough from the error description beneath. Please let me know if the effort is worth it 😉
{
"resource": "/c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/src/models/parcel/parcel.service.ts",
"owner": "typescript",
"code": "2322",
"severity": 8,
"message": "Type 'ParcelUpdateInput' is not assignable to type '(Without<ParcelUpdateInput, ParcelUncheckedUpdateInput> & ParcelUncheckedUpdateInput) | (Without<...> & ParcelUpdateInput)'.\n Type 'ParcelUpdateInput' is not assignable to type 'Without<ParcelUncheckedUpdateInput, ParcelUpdateInput> & ParcelUpdateInput'.\n Type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/@prisma/client/nestjs-graphql/index\").ParcelUpdateInput' is not assignable to type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/.prisma/client/index\").Prisma.ParcelUpdateInput'.\n The types of 'labels.upsert' are incompatible between these types.\n Type 'DalabelUpsertWithWhereUniqueWithoutParcelInput[]' is not assignable to type 'Enumerable<DalabelUpsertWithWhereUniqueWithoutParcelInput>'.\n Type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/@prisma/client/nestjs-graphql/index\").DalabelUpsertWithWhereUniqueWithoutParcelInput[]' is not assignable to type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/.prisma/client/index\").Prisma.DalabelUpsertWithWhereUniqueWithoutParcelInput[]'.\n Type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/@prisma/client/nestjs-graphql/index\").DalabelUpsertWithWhereUniqueWithoutParcelInput' is not assignable to type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/.prisma/client/index\").Prisma.DalabelUpsertWithWhereUniqueWithoutParcelInput'.\n Types of property 'update' are incompatible.\n Type 'DalabelUpdateWithoutParcelInput' is not assignable to type '(Without<DalabelUpdateWithoutParcelInput, DalabelUncheckedUpdateWithoutParcelInput> & DalabelUncheckedUpdateWithoutParcelInput) | (Without<...> & DalabelUpdateWithoutParcelInput)'.\n Type 'DalabelUpdateWithoutParcelInput' is not assignable to type 'Without<DalabelUncheckedUpdateWithoutParcelInput, DalabelUpdateWithoutParcelInput> & DalabelUpdateWithoutParcelInput'.\n Type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/@prisma/client/nestjs-graphql/index\").DalabelUpdateWithoutParcelInput' is not assignable to type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/.prisma/client/index\").Prisma.DalabelUpdateWithoutParcelInput'.\n The types of 'scan_dalabel_scans.upsert' are incompatible between these types.\n Type 'ScanUpsertWithWhereUniqueWithoutDalabelInput[]' is not assignable to type 'Enumerable<ScanUpsertWithWhereUniqueWithoutDalabelInput>'.\n Type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/@prisma/client/nestjs-graphql/index\").ScanUpsertWithWhereUniqueWithoutDalabelInput[]' is not assignable to type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/.prisma/client/index\").Prisma.ScanUpsertWithWhereUniqueWithoutDalabelInput[]'.\n Type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/@prisma/client/nestjs-graphql/index\").ScanUpsertWithWhereUniqueWithoutDalabelInput' is not assignable to type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/.prisma/client/index\").Prisma.ScanUpsertWithWhereUniqueWithoutDalabelInput'.\n Types of property 'update' are incompatible.\n Type 'ScanUpdateWithoutDalabelInput' is not assignable to type '(Without<ScanUpdateWithoutDalabelInput, ScanUncheckedUpdateWithoutDalabelInput> & ScanUncheckedUpdateWithoutDalabelInput) | (Without<...> & ScanUpdateWithoutDalabelInput)'.\n Type 'ScanUpdateWithoutDalabelInput' is not assignable to type 'Without<ScanUncheckedUpdateWithoutDalabelInput, ScanUpdateWithoutDalabelInput> & ScanUpdateWithoutDalabelInput'.\n Type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/@prisma/client/nestjs-graphql/index\").ScanUpdateWithoutDalabelInput' is not assignable to type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/.prisma/client/index\").Prisma.ScanUpdateWithoutDalabelInput'.\n The types of 'parcel.upsert.update' are incompatible between these types.\n Type 'ParcelUpdateWithoutScansInput' is not assignable to type '(Without<ParcelUpdateWithoutScansInput, ParcelUncheckedUpdateWithoutScansInput> & ParcelUncheckedUpdateWithoutScansInput) | (Without<...> & ParcelUpdateWithoutScansInput)'.\n Type 'ParcelUpdateWithoutScansInput' is not assignable to type 'Without<ParcelUncheckedUpdateWithoutScansInput, ParcelUpdateWithoutScansInput> & ParcelUpdateWithoutScansInput'.\n Type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/@prisma/client/nestjs-graphql/index\").ParcelUpdateWithoutScansInput' is not assignable to type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/.prisma/client/index\").Prisma.ParcelUpdateWithoutScansInput'.\n The types of 'delivery.upsert.update' are incompatible between these types.\n Type 'DeliveryUpdateWithoutParcelInput' is not assignable to type '(Without<DeliveryUpdateWithoutParcelInput, DeliveryUncheckedUpdateWithoutParcelInput> & DeliveryUncheckedUpdateWithoutParcelInput) | (Without<...> & DeliveryUpdateWithoutParcelInput)'.\n Type 'DeliveryUpdateWithoutParcelInput' is not assignable to type 'Without<DeliveryUncheckedUpdateWithoutParcelInput, DeliveryUpdateWithoutParcelInput> & DeliveryUpdateWithoutParcelInput'.\n Type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/@prisma/client/nestjs-graphql/index\").DeliveryUpdateWithoutParcelInput' is not assignable to type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/.prisma/client/index\").Prisma.DeliveryUpdateWithoutParcelInput'.\n Types of property 'branch' are incompatible.\n Type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/@prisma/client/nestjs-graphql/index\").BranchUpdateOneWithoutDelivery_branch_deliveriesInput' is not assignable to type 'import(\"c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/.prisma/client/index\").Prisma.BranchUpdateOneWithoutDelivery_branch_deliveriesInput'.",
"source": "ts",
"startLineNumber": 29,
"startColumn": 47,
"endLineNumber": 29,
"endColumn": 51,
"relatedInformation": [
{
"startLineNumber": 16915,
"startColumn": 5,
"endLineNumber": 16915,
"endColumn": 9,
"message": "The expected type comes from property 'data' which is declared here on type '{ select?: ParcelSelect; include?: ParcelInclude; data: (Without<ParcelUpdateInput, ParcelUncheckedUpdateInput> & ParcelUncheckedUpdateInput) | (Without<...> & ParcelUpdateInput); where: ParcelWhereUniqueInput; }'",
"resource": "/c:/Users/tm/TmiCloud/2_TMI/Projects/2021/01_DEAD_LAS2/02_Software/backend/node_modules/.prisma/client/index.d.ts"
}
]
}
BranchUpdateOneWithoutDelivery_branch_deliveriesInput from this library is:
export declare class BranchUpdateOneWithoutDelivery_branch_deliveriesInput {
create?: InstanceType<typeof BranchCreateWithoutDelivery_branch_deliveriesInput>;
connectOrCreate?: InstanceType<typeof BranchCreateOrConnectWithoutDelivery_branch_deliveriesInput>;
upsert?: InstanceType<typeof BranchUpsertWithoutDelivery_branch_deliveriesInput>;
connect?: InstanceType<typeof BranchWhereUniqueInput>;
disconnect?: boolean;
delete?: boolean;
update?: InstanceType<typeof BranchUpdateWithoutDelivery_branch_deliveriesInput>;
}
BranchUpdateOneWithoutDelivery_branch_deliveriesInput from Prisma is:
export type BranchUpdateOneWithoutDelivery_branch_deliveriesInput = {
create?: XOR<BranchCreateWithoutDelivery_branch_deliveriesInput, BranchUncheckedCreateWithoutDelivery_branch_deliveriesInput>
connectOrCreate?: BranchCreateOrConnectWithoutDelivery_branch_deliveriesInput
upsert?: BranchUpsertWithoutDelivery_branch_deliveriesInput
connect?: BranchWhereUniqueInput
disconnect?: boolean
delete?: boolean
update?: XOR<BranchUpdateWithoutDelivery_branch_deliveriesInput, BranchUncheckedUpdateWithoutDelivery_branch_deliveriesInput>
}
Part of the Prisma model is
generator nestjsgraphql {
provider = "node node_modules/prisma-nestjs-graphql"
fields_Validator_from = "class-validator"
fields_Validator_input = true
requireSingleFieldsInWhereUniqueInput = true
emitSingle = true
emitCompiled = true
purgeOutput = true
output = "../node_modules/@prisma/client/nestjs-graphql"
}
model Parcel {
id String @id @default(cuid())
l Float?
b Float?
h Float?
mass Float?
// RELATIONS
labels Dalabel[]
delivery Delivery? @relation(fields: [id_delivery], references: [id])
id_delivery String?
customer Customer? @relation(fields: [customer_number], references: [number])
customer_number String?
surcharges Surcharge[]
// INVERSE RELATIONS
scans Scan[]
}
What I try and where I get the error is at:
import {ParcelUpdateInput} from '@prisma/client/nestjs-graphql';
update(where: ParcelWhereUniqueInput, updateParcelInput: ParcelUpdateInput) {
return this.prisma.parcel.update({ where, data: updateParcelInput });
}
Thank you for taking time!
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 19 (16 by maintainers)
Anyone got found a solution for this?
@TMInnovations I can suggest solution to solve the issue, but it require patch typescript.
tsc.js
and following source of codetargetDepth
(orsourceDepth
) I was able to get rid of error “Excessive stack depth comparing types” in this schema by changingtargetDepth = 200
To automate patching (CI/CD, typescript update), you can use https://github.com/ds300/patch-package
Note: It will fix only cli check, e.g.
tsc --noEmit
, to fix errors in your IDE or 3rd party libs which using typescript API, you probably need patch all files intypescript/lib/*
.Meanwhile looks like https://github.com/microsoft/TypeScript/issues/34933 this issue is most active in discussing this behavior.