@@ -81,14 +81,25 @@ export const _headingToMethodBlock = (
8181) : MethodDocumentationBlock | null => {
8282 if ( ! heading ) return null ;
8383
84+ const methodStringWithGenericRegexp = / ` (?: .+ \. ) ? ( .+ ?) ( < .+ > ) ( \( .* ?\) ) ` ( (?: _ [ ^ _ ] + ?_ ) * ) / g;
8485 const methodStringRegexp = / ` (?: .+ \. ) ? ( .+ ?) ( \( .* ?\) ) ` ( (?: _ [ ^ _ ] + ?_ ) * ) / g;
86+ const methodStringWithGenericMatch = methodStringWithGenericRegexp . exec ( heading . heading ) ;
8587 const methodStringMatch = methodStringRegexp . exec ( heading . heading ) ! ;
8688 methodStringRegexp . lastIndex = - 1 ;
89+ methodStringWithGenericRegexp . lastIndex = - 1 ;
8790 expect ( heading . heading ) . to . match (
8891 methodStringRegexp ,
8992 'each method should have a code blocked method name' ,
9093 ) ;
91- const [ , methodString , methodSignature , headingTags ] = methodStringMatch ;
94+ let methodString : string ;
95+ let methodGenerics = '' ;
96+ let methodSignature : string ;
97+ let headingTags : string ;
98+ if ( methodStringWithGenericMatch ) {
99+ [ , methodString , methodGenerics , methodSignature , headingTags ] = methodStringWithGenericMatch ;
100+ } else {
101+ [ , methodString , methodSignature , headingTags ] = methodStringMatch ;
102+ }
92103
93104 let parameters : MethodDocumentationBlock [ 'parameters' ] = [ ] ;
94105 if ( methodSignature !== '()' ) {
@@ -128,6 +139,7 @@ export const _headingToMethodBlock = (
128139 name : methodString ,
129140 signature : methodSignature ,
130141 description : parsedDescription ,
142+ rawGenerics : methodGenerics || undefined ,
131143 parameters,
132144 returns : parsedReturnType ,
133145 additionalTags : parseHeadingTags ( headingTags ) ,
0 commit comments