You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
atlantis
changed the title
Type confusing when updating a subscription
Type confusion when updating a subscription
May 25, 2023
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: [...]
andadd_invoice_items: [...]
however because the type is applying to both of them I get:Since the
add_invoice_items
named tuple doesn't take theid
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?The text was updated successfully, but these errors were encountered: