diff --git a/types/Invoices.d.ts b/types/Invoices.d.ts index ebab8c1b58..cf259360fd 100644 --- a/types/Invoices.d.ts +++ b/types/Invoices.d.ts @@ -40,7 +40,7 @@ declare module 'stripe' { /** * Unique identifier for the object. This property is always present unless the invoice is an upcoming invoice. See [Retrieve an upcoming invoice](https://stripe.com/docs/api/invoices/upcoming) for more details. */ - id?: string; + id: string; /** * String representing the object's type. Objects of the same type share the same value. diff --git a/types/InvoicesResource.d.ts b/types/InvoicesResource.d.ts index 0764464bc3..a055886235 100644 --- a/types/InvoicesResource.d.ts +++ b/types/InvoicesResource.d.ts @@ -2168,10 +2168,10 @@ declare module 'stripe' { retrieveUpcoming( params?: InvoiceRetrieveUpcomingParams, options?: RequestOptions - ): Promise>; + ): Promise>; retrieveUpcoming( options?: RequestOptions - ): Promise>; + ): Promise>; /** * Search for invoices you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language). diff --git a/types/UpcomingInvoices.d.ts b/types/UpcomingInvoices.d.ts new file mode 100644 index 0000000000..02a5efc7d8 --- /dev/null +++ b/types/UpcomingInvoices.d.ts @@ -0,0 +1,5 @@ +declare module 'stripe' { + namespace Stripe { + type UpcomingInvoice = Omit; + } +} diff --git a/types/index.d.ts b/types/index.d.ts index e1d31b5505..9903ffea28 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -7,6 +7,7 @@ /// /// /// +/// /// /// /// diff --git a/types/test/typescriptTest.ts b/types/test/typescriptTest.ts index 983ff53088..082e46d789 100644 --- a/types/test/typescriptTest.ts +++ b/types/test/typescriptTest.ts @@ -123,6 +123,10 @@ stripe = new Stripe('sk_test_123', { return undefined; }); + // @ts-expect-error + (await stripe.invoices.retrieveUpcoming()).id; + (await stripe.invoices.retrieve('')).id; + try { await stripe.paymentIntents.create({amount: 100, currency: 'USD'}); } catch (err) {