Type confusion when updating a subscription
atlantis opened this issue · comments
Hey I'm not exactly sure what's the cleanest way to solve this so I'm just going to explain it for now:
I'm trying to update_subscription with BOTH items: [...]
and add_invoice_items: [...]
however because the type is applying to both of them I get:
Error: expected argument 'add_invoice_items' to 'Stripe::Subscription.update' to be (Array(NamedTuple(id: String, price: String, quantity: Int32)) | Nil), not Array(NamedTuple(price: String, quantity: Int32))
Since the add_invoice_items
named tuple doesn't take the id
field. I can update the subscription in two separate calls and it works fine, but it won't compile if I try to update both fields in the same call.
Any ideas for how to solve that cleanly? If I change update_subscription.cr to add_invoice_items : T? | Unset = Unset.new
it works, but not sure what that T was there for previously and perhaps I'm messing something up?
@atlantis sorry for the late response. Have you figured it out? I can look into it. See if I can update it.
Hi @confact no worries: for now I'm just making two separate calls as a workaround!