@@ -210,7 +210,8 @@ export function generateImports(state: ProcessingState): string[] {
210210 const processContent = ( content : string ) => {
211211 // Track used values - now includes both function calls and references
212212 const valueRegex = / \b ( [ a - z _ $ ] [ \w $ ] * ) \s * (?: [ ( , ; } ) \s ] | $ ) / gi
213- let match
213+ let match : any
214+ // eslint-disable-next-line no-cond-assign
214215 while ( ( match = valueRegex . exec ( content ) ) !== null ) {
215216 const [ , value ] = match
216217 if ( state . availableValues . has ( value ) ) {
@@ -913,14 +914,10 @@ export interface TypeReference {
913914 * Extract complete function signature handling multi-line declarations
914915 */
915916export function extractFunctionSignature ( declaration : string ) : FunctionSignature {
916- console . log ( '\n[Function Signature Extraction]' )
917- console . log ( 'Input declaration:' , declaration )
918-
919917 // Check if the main function declaration is async
920918 // Only match 'async' at the start of the declaration before 'function'
921919 const isAsync = / ^ e x p o r t \s + a s y n c \s + f u n c t i o n / . test ( declaration )
922920 || / ^ a s y n c \s + f u n c t i o n / . test ( declaration )
923- console . log ( 'Is async:' , isAsync )
924921
925922 // Remove export keyword and clean up whitespace
926923 const cleanDeclaration = declaration
@@ -929,48 +926,39 @@ export function extractFunctionSignature(declaration: string): FunctionSignature
929926 . replace ( / ^ f u n c t i o n \s + / , '' )
930927 . trim ( )
931928
932- console . log ( 'Cleaned declaration:' , cleanDeclaration )
933-
934929 // Extract complete generic section with improved regex
935930 const genericsRegex = / ^ ( [ a - z _ $ ] [ \w $ ] * ) \s * ( < [ ^ ( ] + > ) / i
936931 const genericsMatch = cleanDeclaration . match ( genericsRegex )
937- console . log ( 'Generics match:' , genericsMatch )
938932
939933 // Process generics if found
940934 let generics = ''
941935 let nameFromGenerics = ''
942936 if ( genericsMatch ) {
943937 nameFromGenerics = genericsMatch [ 1 ]
944938 generics = genericsMatch [ 2 ]
945- console . log ( 'Raw generics:' , generics )
946939 }
947940
948941 // Remove generics for further parsing
949942 const withoutGenerics = cleanDeclaration
950943 . replace ( genericsRegex , nameFromGenerics )
951- console . log ( 'Declaration without generics:' , withoutGenerics )
952944
953945 // Extract function name (use the one we got from generics match if available)
954946 const name = nameFromGenerics || withoutGenerics . match ( / ^ ( [ ^ ( < \s ] + ) / ) ?. [ 1 ] || ''
955- console . log ( 'Extracted name:' , name )
956947
957948 // Extract parameters section
958949 const paramsMatch = withoutGenerics . match ( / \( ( [ \s \S ] * ?) \) (? = \s * : ) / )
959950 let params = paramsMatch ? paramsMatch [ 1 ] . trim ( ) : ''
960- console . log ( 'Raw parameters:' , params )
961951
962952 // Clean up parameters while preserving generic references
963953 params = cleanParameters ( params )
964- console . log ( 'Cleaned parameters:' , params )
965954
966955 // Extract return type
956+ // eslint-disable-next-line regexp/no-super-linear-backtracking
967957 const returnTypeMatch = withoutGenerics . match ( / \) \s * : \s * ( [ \s \S ] + ?) (? = \{ | $ ) / )
968958 let returnType = returnTypeMatch ? returnTypeMatch [ 1 ] . trim ( ) : 'void'
969- console . log ( 'Raw return type:' , returnType )
970959
971960 // Clean up return type
972961 returnType = normalizeType ( returnType )
973- console . log ( 'Normalized return type:' , returnType )
974962
975963 const result = {
976964 name,
@@ -980,7 +968,6 @@ export function extractFunctionSignature(declaration: string): FunctionSignature
980968 generics,
981969 }
982970
983- console . log ( 'Final signature:' , result )
984971 return result
985972}
986973
@@ -992,9 +979,6 @@ export function processFunctionDeclaration(
992979 usedTypes : Set < string > ,
993980 isExported = true ,
994981) : string {
995- console . log ( '\n[Process Function Declaration]' )
996- console . log ( 'Input declaration:' , declaration )
997-
998982 const {
999983 name,
1000984 params,
@@ -1005,7 +989,6 @@ export function processFunctionDeclaration(
1005989
1006990 // Track all used types including generics
1007991 trackUsedTypes ( `${ generics } ${ params } ${ returnType } ` , usedTypes )
1008- console . log ( 'Tracked types:' , Array . from ( usedTypes ) )
1009992
1010993 // Build declaration string
1011994 const parts = [
@@ -1029,7 +1012,6 @@ export function processFunctionDeclaration(
10291012 . replace ( / \s { 2 , } / g, ' ' )
10301013 . trim ( )
10311014
1032- console . log ( 'Final declaration:' , result )
10331015 return result
10341016}
10351017
@@ -1078,8 +1060,9 @@ function normalizeType(type: string): string {
10781060export function trackUsedTypes ( content : string , usedTypes : Set < string > ) : void {
10791061 // Track type references in generics, parameters, and return types
10801062 const typePattern = / (?: t y p e o f \s + ) ? ( [ A - Z ] \w * (?: < [ ^ > ] + > ) ? ) | e x t e n d s \s + ( [ A - Z ] \w * (?: < [ ^ > ] + > ) ? ) / g
1081- let match
1063+ let match : any
10821064
1065+ // eslint-disable-next-line no-cond-assign
10831066 while ( ( match = typePattern . exec ( content ) ) !== null ) {
10841067 const type = match [ 1 ] || match [ 2 ]
10851068 if ( type ) {
@@ -1090,9 +1073,9 @@ export function trackUsedTypes(content: string, usedTypes: Set<string>): void {
10901073
10911074 // Process generic parameters
10921075 if ( genericParams . length > 0 ) {
1093- genericParams . forEach ( ( param ) => {
1076+ genericParams . forEach ( ( param : any ) => {
10941077 const nestedTypes = param . split ( / [ , \s ] / )
1095- nestedTypes . forEach ( ( t ) => {
1078+ nestedTypes . forEach ( ( t : any ) => {
10961079 if ( / ^ [ A - Z ] / . test ( t ) )
10971080 usedTypes . add ( t )
10981081 } )
0 commit comments