@@ -34,11 +34,17 @@ export const parseListIntoProperties = node => {
3434
3535 if ( children [ 0 ] . type === 'inlineCode' ) {
3636 name = children . shift ( ) . value . trimEnd ( ) ;
37- } else if ( children [ 0 ] . value && children [ 0 ] . value . startsWith ( 'Returns' ) ) {
38- name = 'Returns' ;
39- children [ 0 ] . value = children [ 0 ] . value . replace ( / ^ R e t u r n s : ? \s * / i, '' ) ;
40- if ( ! children [ 0 ] . value . trim ( ) ) {
41- children . shift ( ) ;
37+ } else if ( children [ 0 ] . value ) {
38+ const starter = children [ 0 ] . value . match (
39+ createQueries . QUERIES . typedListStarters
40+ ) ;
41+
42+ if ( starter ) {
43+ name = starter [ 1 ] !== 'Type' && starter [ 1 ] ;
44+ children [ 0 ] . value = children [ 0 ] . value . slice ( starter [ 0 ] . length ) ;
45+ if ( ! children [ 0 ] . value . trim ( ) ) {
46+ children . shift ( ) ;
47+ }
4248 }
4349 }
4450
@@ -89,13 +95,9 @@ export const createPropertyTable = (node, withHeading = true) => {
8995 const rows = properties . flatMap ( prop => {
9096 const cells = [ ] ;
9197
92- if ( prop . name ?. startsWith ( 'Returns' ) ) {
93- cells . push ( createElement ( 'td' , 'Returns' ) ) ;
94- } else {
95- cells . push (
96- createElement ( 'td' , prop . name ? createElement ( 'code' , prop . name ) : '-' )
97- ) ;
98- }
98+ cells . push (
99+ createElement ( 'td' , prop . name ? createElement ( 'code' , prop . name ) : '-' )
100+ ) ;
99101
100102 cells . push ( createElement ( 'td' , prop . types . length > 0 ? prop . types : '-' ) ) ;
101103 cells . push ( createElement ( 'td' , prop . desc . length > 0 ? prop . desc : '-' ) ) ;
@@ -139,9 +141,13 @@ export const createPropertyTable = (node, withHeading = true) => {
139141 */
140142export const generateSignature = (
141143 functionName ,
142- { params, return : returnType } ,
144+ { params, return : returnType , extends : extendsType } ,
143145 prefix = ''
144146) => {
147+ if ( extendsType ) {
148+ return `class ${ prefix } ${ functionName } extends ${ extendsType . type } ` ;
149+ }
150+
145151 const returnStr = returnType ? `: ${ returnType . type } ` : '' ;
146152 const paramsStr = params
147153 . map ( param => {
@@ -195,13 +201,19 @@ export const getFullName = ({ name, text }, fallback = name) => {
195201 */
196202export default ( { children } , { data } , idx ) => {
197203 // Find the list in the parent
198- const list = children . find ( createQueries . UNIST . isTypedList ) ;
204+ const listIdx = children . findIndex ( createQueries . UNIST . isTypedList ) ;
199205
200- const params = list ? list . children . map ( parseListItem ) : [ ] ;
206+ const params =
207+ listIdx >= 0 ? children [ listIdx ] . children . map ( parseListItem ) : [ ] ;
201208
202209 const signature = parseSignature ( data . text , params ) ;
203210 const displayName = getFullName ( data ) ;
204211
212+ if ( data . type === 'class' ) {
213+ // Remove the 'Extends' list
214+ children . splice ( listIdx , 1 ) ;
215+ }
216+
205217 children . splice (
206218 idx ,
207219 0 ,
0 commit comments