mrjfrcdo
mrjfrcdo
PPrisma
Created by mrjfrcdo on 10/16/2024 in #help-and-questions
How to dynamically get relationships of a from a wrapper function?
I have a function that only returns the value of prisma like so:
findUniqueOrThrow(args: Prisma.SomethingFindUniqueOrThrowArgs) {
return this.prismaService.something.findUniqueOrThrow(args);
}
findUniqueOrThrow(args: Prisma.SomethingFindUniqueOrThrowArgs) {
return this.prismaService.something.findUniqueOrThrow(args);
}
but when I try to use it like this. I cannot access the rest of the models.
const something = findUniqueOrThrow({
id: 1,
include: {
somethingElse: true,
},
});

// something.somethingElse cannot be found by typescript.
const something = findUniqueOrThrow({
id: 1,
include: {
somethingElse: true,
},
});

// something.somethingElse cannot be found by typescript.
2 replies