@@ -185,8 +185,8 @@ export function useComponentMetaParser (
185
185
component . meta . events = metaFields . events ? events : [ ]
186
186
component . meta . exposed = metaFields . exposed ? exposed : [ ]
187
187
component . meta . props = ( metaFields . props ? props : [ ] )
188
- . filter ( prop => ! prop . global )
189
- . sort ( ( a , b ) => {
188
+ . filter ( ( prop : any ) => ! prop . global )
189
+ . sort ( ( a : { type : string , required : boolean } , b : { type : string , required : boolean } ) => {
190
190
// sort required properties first
191
191
if ( ! a . required && b . required ) {
192
192
return 1
@@ -205,10 +205,10 @@ export function useComponentMetaParser (
205
205
return 0
206
206
} )
207
207
208
- component . meta . props = component . meta . props . map ( stripeTypeScriptInternalTypesSchema )
209
- component . meta . slots = component . meta . slots . map ( stripeTypeScriptInternalTypesSchema )
210
- component . meta . exposed = component . meta . exposed . map ( stripeTypeScriptInternalTypesSchema )
211
- component . meta . events = component . meta . events . map ( stripeTypeScriptInternalTypesSchema )
208
+ component . meta . props = component . meta . props . map ( ( sch : any ) => stripeTypeScriptInternalTypesSchema ( sch , true ) )
209
+ component . meta . slots = component . meta . slots . map ( ( sch : any ) => stripeTypeScriptInternalTypesSchema ( sch , true ) )
210
+ component . meta . exposed = component . meta . exposed . map ( ( sch : any ) => stripeTypeScriptInternalTypesSchema ( sch , true ) )
211
+ component . meta . events = component . meta . events . map ( ( sch : any ) => stripeTypeScriptInternalTypesSchema ( sch , true ) )
212
212
213
213
// Remove descriptional fileds to reduce chunk size
214
214
removeFields ( component . meta , [ 'declarations' ] )
@@ -264,24 +264,24 @@ function removeFields(obj: Record<string, any>, fieldsToRemove: string[]): any {
264
264
return obj ;
265
265
}
266
266
267
- function stripeTypeScriptInternalTypesSchema ( type : any ) : any {
267
+ function stripeTypeScriptInternalTypesSchema ( type : any , topLevel : boolean = true ) : any {
268
268
if ( ! type ) {
269
269
return type
270
270
}
271
271
272
- if ( type . declarations && type . declarations . find ( ( d : any ) => d . file . includes ( 'node_modules/typescript' ) || d . file . includes ( '@vue/runtime-core' ) ) ) {
272
+ if ( ! topLevel && type . declarations && type . declarations . find ( ( d : any ) => d . file . includes ( 'node_modules/typescript' ) || d . file . includes ( '@vue/runtime-core' ) ) ) {
273
273
return false
274
274
}
275
275
276
276
if ( Array . isArray ( type ) ) {
277
- return type . map ( ( sch : any ) => stripeTypeScriptInternalTypesSchema ( sch ) ) . filter ( r => r !== false )
277
+ return type . map ( ( sch : any ) => stripeTypeScriptInternalTypesSchema ( sch , false ) ) . filter ( r => r !== false )
278
278
}
279
279
280
280
if ( Array . isArray ( type . schema ) ) {
281
281
return {
282
282
...type ,
283
283
declarations : undefined ,
284
- schema : type . schema . map ( ( sch : any ) => stripeTypeScriptInternalTypesSchema ( sch ) ) . filter ( ( r : any ) => r !== false )
284
+ schema : type . schema . map ( ( sch : any ) => stripeTypeScriptInternalTypesSchema ( sch , false ) ) . filter ( ( r : any ) => r !== false )
285
285
}
286
286
}
287
287
@@ -294,14 +294,14 @@ function stripeTypeScriptInternalTypesSchema (type: any): any {
294
294
if ( sch === 'schema' && type . schema [ sch ] ) {
295
295
schema [ sch ] = schema [ sch ] || { }
296
296
Object . keys ( type . schema [ sch ] ) . forEach ( ( sch2 ) => {
297
- const res = stripeTypeScriptInternalTypesSchema ( type . schema [ sch ] [ sch2 ] )
297
+ const res = stripeTypeScriptInternalTypesSchema ( type . schema [ sch ] [ sch2 ] , false )
298
298
if ( res !== false ) {
299
299
schema [ sch ] [ sch2 ] = res
300
300
}
301
301
} )
302
302
return
303
303
}
304
- const res = stripeTypeScriptInternalTypesSchema ( type . schema [ sch ] )
304
+ const res = stripeTypeScriptInternalTypesSchema ( type . schema [ sch ] , false )
305
305
306
306
if ( res !== false ) {
307
307
schema [ sch ] = res
0 commit comments