@@ -776,6 +776,15 @@ export default TurboModuleRegistry.getEnforcing<Spec>('${moduleName}');
776776 const files = await fs . readdir ( codegenDir ) ;
777777 const specFiles = files . filter ( file => file . endsWith ( 'Spec.g.h' ) ) ;
778778
779+ if ( specFiles . length === 0 ) {
780+ this . verboseMessage (
781+ 'No Spec.g.h files found in codegen directory. This typically means the TurboModule spec file needs to be created or codegen needs to be run.' ,
782+ ) ;
783+ return ;
784+ }
785+
786+ this . verboseMessage ( `Found ${ specFiles . length } codegen spec file(s): ${ specFiles . join ( ', ' ) } ` ) ;
787+
779788 for ( const specFile of specFiles ) {
780789 const specName = specFile . replace ( 'Spec.g.h' , '' ) ;
781790 const windowsDir = path . join ( this . root , 'windows' ) ;
@@ -786,9 +795,19 @@ export default TurboModuleRegistry.getEnforcing<Spec>('${moduleName}');
786795 await fs . mkdir ( windowsDir , { recursive : true } ) ;
787796 }
788797
789- // Parse the TypeScript spec file for method signatures
798+ // Parse method signatures from codegen files first, then fallback to TypeScript spec files
790799 const methods = await this . parseSpecFileForMethods ( specName ) ;
791800
801+ if ( methods . length === 0 ) {
802+ this . verboseMessage (
803+ `No methods found for ${ specName } . The generated files will contain empty stubs with TODO comments.` ,
804+ ) ;
805+ } else {
806+ this . verboseMessage (
807+ `Found ${ methods . length } methods from ${ specName } : ${ methods . map ( m => m . name ) . join ( ', ' ) } ` ,
808+ ) ;
809+ }
810+
792811 // Generate header file with parsed methods
793812 const headerContent = await this . generateHeaderStub ( specName , methods ) ;
794813 // Always write the header file to ensure it has the correct methods from the spec
0 commit comments