Skip to content

Commit 3728d72

Browse files
feat(parser): remove declarations from types (#68)
1 parent 10ad753 commit 3728d72

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/parser.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -253,22 +253,23 @@ function stripeTypeScriptInternalTypesSchema (type: any): any {
253253
if (Array.isArray(type.schema)) {
254254
return {
255255
...type,
256+
declarations: undefined,
256257
schema: type.schema.map((sch: any) => stripeTypeScriptInternalTypesSchema(sch)).filter((r: any) => r !== false)
257258
}
258259
}
259260

260261
if (!type.schema || typeof type.schema !== 'object') {
261-
return type
262+
return typeof type === 'object' ? { ...type, declarations: undefined } : type
262263
}
263264

264265
const schema: any = {}
265266
Object.keys(type.schema).forEach((sch) => {
266267
if (sch === 'schema' && type.schema[sch]) {
267268
schema[sch] = schema[sch] || {}
268269
Object.keys(type.schema[sch]).forEach((sch2) => {
269-
const res = stripeTypeScriptInternalTypesSchema(type.schema[sch][sch2]);
270+
const res = stripeTypeScriptInternalTypesSchema(type.schema[sch][sch2])
270271
if (res !== false) {
271-
schema[sch][sch2] = res;
272+
schema[sch][sch2] = res
272273
}
273274
})
274275
return
@@ -282,6 +283,7 @@ function stripeTypeScriptInternalTypesSchema (type: any): any {
282283

283284
return {
284285
...type,
286+
declarations: undefined,
285287
schema
286288
}
287289
}

0 commit comments

Comments
 (0)