Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type confusion when updating a subscription #65

Open
atlantis opened this issue May 25, 2023 · 2 comments
Open

Type confusion when updating a subscription #65

atlantis opened this issue May 25, 2023 · 2 comments

Comments

@atlantis
Copy link
Contributor

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 atlantis changed the title Type confusing when updating a subscription Type confusion when updating a subscription May 25, 2023
@confact
Copy link
Owner

confact commented Sep 9, 2023

@atlantis sorry for the late response. Have you figured it out? I can look into it. See if I can update it.

@atlantis
Copy link
Contributor Author

atlantis commented Sep 9, 2023

Hi @confact no worries: for now I'm just making two separate calls as a workaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants