@@ -90,23 +90,6 @@ export const parseType = (typeString, transformType) => {
9090 return null ;
9191 }
9292
93- // Handle Functions (=>)
94- if ( trimmed . includes ( '=>' ) ) {
95- const parts = splitByOuterSeparator ( trimmed , '=>' ) ;
96- if ( parts . length > 1 ) {
97- const params = parts [ 0 ] ;
98-
99- // Join the rest back together to handle higher-order functions
100- const returnType = parts . slice ( 1 ) . join ( ' => ' ) ;
101-
102- // Preserve the function signature, just link the return type for now
103- // (Mapping param types inside the signature string is complex and often unnecessary for simple docs)
104- const parsedReturn =
105- parseType ( returnType , transformType ) || `\`<${ returnType } >\`` ;
106- return `${ params } => ${ parsedReturn } ` ;
107- }
108- }
109-
11093 // Handle Unions (|)
11194 if ( trimmed . includes ( '|' ) ) {
11295 const parts = splitByOuterSeparator ( trimmed , '|' ) ;
@@ -131,6 +114,23 @@ export const parseType = (typeString, transformType) => {
131114 }
132115 }
133116
117+ // Handle Functions (=>)
118+ if ( trimmed . includes ( '=>' ) ) {
119+ const parts = splitByOuterSeparator ( trimmed , '=>' ) ;
120+ if ( parts . length > 1 ) {
121+ const params = parts [ 0 ] ;
122+
123+ // Join the rest back together to handle higher-order functions
124+ const returnType = parts . slice ( 1 ) . join ( ' => ' ) ;
125+
126+ // Preserve the function signature, just link the return type for now
127+ // (Mapping param types inside the signature string is complex and often unnecessary for simple docs)
128+ const parsedReturn =
129+ parseType ( returnType , transformType ) || `\`<${ returnType } >\`` ;
130+ return `${ params } => ${ parsedReturn } ` ;
131+ }
132+ }
133+
134134 // Handle Generics (Base<Inner, Inner>)
135135 // Check if it's a generic wrapped in an array (e.g., Promise<string>[])
136136 const isGenericArray = trimmed . endsWith ( '[]' ) ;
0 commit comments