From 2173cd48c96778a37712cfdafcdbaf3e330aa953 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Mon, 26 Oct 2020 11:59:54 -0400 Subject: [PATCH 1/2] Add Stripe.Emptyable type definition --- types/lib.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/lib.d.ts b/types/lib.d.ts index 4dd672a781..f146082045 100644 --- a/types/lib.d.ts +++ b/types/lib.d.ts @@ -196,6 +196,13 @@ declare module 'stripe' { autoPagingToArray(opts: {limit: number}): Promise>; } + /** + * The Stripe API uses url-encoding for requests, and stripe-node encodes a + * `null` param as an empty string, because there is no concept of `null` + * in url-encoding. + */ + export type Emptyable = null | '' | T; + export interface RequestEvent { api_version: string; account?: string; From 8a4169a68636817a43edc271a88f127e18373f4e Mon Sep 17 00:00:00 2001 From: richardm-stripe <52928443+richardm-stripe@users.noreply.github.com> Date: Mon, 26 Oct 2020 12:05:15 -0400 Subject: [PATCH 2/2] Bit more clarity --- types/lib.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/lib.d.ts b/types/lib.d.ts index f146082045..a11983264a 100644 --- a/types/lib.d.ts +++ b/types/lib.d.ts @@ -199,7 +199,7 @@ declare module 'stripe' { /** * The Stripe API uses url-encoding for requests, and stripe-node encodes a * `null` param as an empty string, because there is no concept of `null` - * in url-encoding. + * in url-encoding. Both `null` and `''` behave identically. */ export type Emptyable = null | '' | T;