@@ -37,7 +37,7 @@ function getSpace(indent: number) {
3737
3838function generateType ( typeInfoMap : TypeInfo , indent = 0 ) {
3939 const typeList : string [ ] = [ ] ;
40- for ( const name in typeInfoMap ) {
40+ Object . keys ( typeInfoMap ) . sort ( ) . forEach ( ( name ) => {
4141 const typeInfo = typeInfoMap [ name ] ;
4242 const objFlag = typeof typeInfo === 'object' ;
4343 objFlag && typeList . push ( `${ getSpace ( indent ) } ${ indent ? `${ name } : {` : `interface I${ pascalCase ( name ) } {` } ` ) ;
@@ -48,7 +48,7 @@ function generateType(typeInfoMap: TypeInfo, indent = 0) {
4848 typeList . push ( `${ getSpace ( indent ) } ${ name } : ${ typeInfo } ;` ) ;
4949 }
5050 objFlag && typeList . push ( `${ getSpace ( indent ) } }` ) ;
51- }
51+ } ) ;
5252 return typeList . join ( '\n' ) ;
5353}
5454
@@ -82,15 +82,15 @@ export async function generateTypeString(fileInfo: FileInfoMap) {
8282 const originTypeInfoMap = generateTypeInfo ( fileInfo ) ;
8383 const typeInfoMap = { ...originTypeInfoMap } ;
8484
85- const userTypeContent = [ ] ;
85+ const userTypeContent : string [ ] = [ ] ;
8686
87- for ( const type in typeInfoMap ) {
87+ await Promise . all ( Object . keys ( typeInfoMap ) . sort ( ) . map ( async ( type ) => {
8888 const _interface = await getInterface ( type , typeInfoMap [ type ] as TypeInfo ) ;
8989 if ( ! _interface )
90- continue ;
90+ return ;
9191 delete typeInfoMap [ type ] ;
9292 userTypeContent . push ( _interface ) ;
93- }
93+ } ) ) ;
9494
9595 const routerSchemaTypeContent = '' ; // routerSchemaTypeMerge(typeInfoMap);
9696
0 commit comments