What's the best practice for selecting an item only if a nullable field is not-null?
In this case, I have a
type Patient
which has a nullable field called stripeCustomerId
. I create the patient earlier, and when I collect customer information, I add to it.
Although, sometimes, I want to getPatient
but I want it to throw an error if stripeCustomerId
or another similar field is missing. I'd also like to handle errors in my getPatient
function, so I don't have to handle errors everytime I call it.
I created this, but I'm wondering if there's a better way. I'm still a novice.
0 Replies