@@ -185,8 +185,8 @@ export function useComponentMetaParser (
185185 component . meta . events = metaFields . events ? events : [ ]
186186 component . meta . exposed = metaFields . exposed ? exposed : [ ]
187187 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 } ) => {
190190 // sort required properties first
191191 if ( ! a . required && b . required ) {
192192 return 1
@@ -205,10 +205,10 @@ export function useComponentMetaParser (
205205 return 0
206206 } )
207207
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 ) )
212212
213213 // Remove descriptional fileds to reduce chunk size
214214 removeFields ( component . meta , [ 'declarations' ] )
@@ -264,24 +264,24 @@ function removeFields(obj: Record<string, any>, fieldsToRemove: string[]): any {
264264 return obj ;
265265}
266266
267- function stripeTypeScriptInternalTypesSchema ( type : any ) : any {
267+ function stripeTypeScriptInternalTypesSchema ( type : any , topLevel : boolean = true ) : any {
268268 if ( ! type ) {
269269 return type
270270 }
271271
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' ) ) ) {
273273 return false
274274 }
275275
276276 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 )
278278 }
279279
280280 if ( Array . isArray ( type . schema ) ) {
281281 return {
282282 ...type ,
283283 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 )
285285 }
286286 }
287287
@@ -294,14 +294,14 @@ function stripeTypeScriptInternalTypesSchema (type: any): any {
294294 if ( sch === 'schema' && type . schema [ sch ] ) {
295295 schema [ sch ] = schema [ sch ] || { }
296296 Object . keys ( type . schema [ sch ] ) . forEach ( ( sch2 ) => {
297- const res = stripeTypeScriptInternalTypesSchema ( type . schema [ sch ] [ sch2 ] )
297+ const res = stripeTypeScriptInternalTypesSchema ( type . schema [ sch ] [ sch2 ] , false )
298298 if ( res !== false ) {
299299 schema [ sch ] [ sch2 ] = res
300300 }
301301 } )
302302 return
303303 }
304- const res = stripeTypeScriptInternalTypesSchema ( type . schema [ sch ] )
304+ const res = stripeTypeScriptInternalTypesSchema ( type . schema [ sch ] , false )
305305
306306 if ( res !== false ) {
307307 schema [ sch ] = res
0 commit comments