FabulouSebas
FabulouSebas
PPrisma
Created by FabulouSebas on 5/24/2024 in #help-and-questions
Change query typing to respect where null, or where not null
Hello sir, very sorry for the late response, I will ensure fast responses for the rest of the week! Let me clarify, I do not think I was clear enough! My issue is really just about the typing returned by a find (many or single). In my database, the relation is nullable. Thus, fetching the payments from my database, the typing of a single payment's relationId property payment.relationId would be number | null because it is nullable. This means I need to make sure payment.relationId is not null before using it. In my case, I know for a fact that after the payments are successful, the payments have a relationId. I would want to be able to do where: { relationId: { not: null }, } and have the typing of payment.relationId to be number. Since in the where, I ensure relationId is not null, I would want the typing to reflect that as well
4 replies