From 22b307b9ab49c8ac8d3f77175c8430e09362423f Mon Sep 17 00:00:00 2001 From: Farnabaz Date: Wed, 17 Jan 2024 16:46:05 +0100 Subject: [PATCH] fix(stripe-types): respect array & non-object types --- src/parser.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/parser.ts b/src/parser.ts index 887c016..8a5c180 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -260,6 +260,16 @@ function stripeTypeScriptInternalTypesSchema (type: any): any { } } + if (typeof type.schema !== 'object') { + return type + } + + if (Array.isArray(type.schema)) { + return type.schema + .map((sch: any) => stripeTypeScriptInternalTypesSchema(sch)) + .filter((r: any) => r !== false) + } + const schema: any = {} Object.keys(type.schema).forEach((sch) => { const res = stripeTypeScriptInternalTypesSchema(type.schema[sch])