Skip to content

Commit 8435f4c

Browse files
committed
fix(stripe-types): missing type in array schema
1 parent 22b307b commit 8435f4c

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

src/parser.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ function stripeTypeScriptInternalTypesSchema (type: any): any {
240240
if (!type) {
241241
return type
242242
}
243+
243244
if (type.declarations && type.declarations.find((d: any) => d.file.includes('node_modules/typescript'))) {
244245
return false
245246
}
@@ -248,28 +249,17 @@ function stripeTypeScriptInternalTypesSchema (type: any): any {
248249
return type.map((sch: any) => stripeTypeScriptInternalTypesSchema(sch)).filter(r => r !== false)
249250
}
250251

251-
if (!type.schema) {
252-
return type
253-
}
254-
255-
if (type.schema.schema) {
256-
const res = stripeTypeScriptInternalTypesSchema(type.schema)
252+
if (Array.isArray(type.schema)) {
257253
return {
258254
...type,
259-
schema: res
255+
schema: type.schema.map((sch: any) => stripeTypeScriptInternalTypesSchema(sch)).filter((r: any) => r !== false)
260256
}
261257
}
262258

263-
if (typeof type.schema !== 'object') {
259+
if (!type.schema || typeof type.schema !== 'object') {
264260
return type
265261
}
266262

267-
if (Array.isArray(type.schema)) {
268-
return type.schema
269-
.map((sch: any) => stripeTypeScriptInternalTypesSchema(sch))
270-
.filter((r: any) => r !== false)
271-
}
272-
273263
const schema: any = {}
274264
Object.keys(type.schema).forEach((sch) => {
275265
const res = stripeTypeScriptInternalTypesSchema(type.schema[sch])

0 commit comments

Comments
 (0)