-
Notifications
You must be signed in to change notification settings - Fork 764
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
Invoice.id is shouldn't be optional #1500
Comments
Any update on this? Would like to avoid all the extra null checks 🙂 |
We're working on the issue with the product team. Apologies for the delay. The resource represents both Invoice and UpcomingInvoice, where the ID is optional. That's why it was made optional and the fix is not as easy as reverting the change. |
Thanks for the update! |
Any update on this issue ? The type is still optional for v11.1.0 : https://github.com/stripe/stripe-node/blob/v11.1.0/types/2022-11-15/Invoices.d.ts#L43 |
Can someone from stripe explain why it was done like this ? and not with a upcomingInvoice Type ? as done in the PR ? |
Hello @julestruong. Our default strategy is to establish a single type for each "resource" that is broad enough to capture the return values of all the methods on that resource, so because We have a pretty strong bias against making exceptions to our default patterns. Even when an exception makes an interface locally better, a library that's full of special cases is globally worse. Given all the feedback here though, it's pretty clear that #1629 is the way to go. |
That was really nice of you to take the time to explain your strategy. |
Describe the bug
According to https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-id,
invoice.id
should be required.As I am upgrading to v10.0.0, it looks like it was made optional
stripe-node/types/2022-08-01/Invoices.d.ts
Line 12 in 0cd1aa7
To Reproduce
Perform any operation on an invoice and get an incorrectly typed object as the response.
Expected behavior
This should be a required property so I don't have to litter my code with unnecessary run-time undefined checks.
Code snippets
No response
OS
macOS
Node version
All Node Version
Library version
stripe-node v10.0.0
API version
2022-08-01
Additional context
No response
The text was updated successfully, but these errors were encountered: