@@ -3,21 +3,23 @@ import { JSONOutput } from "typedoc";
33import { Code } from "pages/components/code" ;
44import { Type } from "pages/components/type" ;
55import { PagePropsType } from "types/page.types" ;
6- import { getCallPreview } from "pages/utils/parsing.utils" ;
76import { getCommentNode } from "pages/handlers/comment" ;
7+ import { getSignaturePreview } from "pages/utils" ;
88
99export const Table = ( {
1010 reflections,
1111 reflectionsTree,
1212 pageProps,
1313 title,
1414 className = "" ,
15+ hideType = false ,
1516} : {
1617 reflections : JSONOutput . SomeReflection [ ] ;
1718 reflectionsTree : JSONOutput . ProjectReflection [ ] ;
1819 pageProps : PagePropsType ;
1920 title ?: string ;
2021 className ?: string ;
22+ hideType ?: boolean ;
2123} ) => {
2224 return (
2325 < div className = { `api-docs__table-wrapper ${ className } ` } >
@@ -26,31 +28,42 @@ export const Table = ({
2628 < thead >
2729 < tr >
2830 < th > Name</ th >
29- < th > Type</ th >
31+ { ! hideType && < th > Type</ th > }
3032 < th > Description</ th >
3133 </ tr >
3234 </ thead >
3335 < tbody >
3436 { reflections . map ( ( reflection , index ) => {
3537 const isMethod = "signatures" in reflection ;
36- const callSignature =
37- ( "signatures" in reflection &&
38- reflection ?. signatures &&
39- getCallPreview ( { signature : reflection . signatures [ 0 ] , reflectionsTree } ) ) ||
40- "" ;
38+ const name =
39+ "signatures" in reflection && reflection ?. signatures
40+ ? getSignaturePreview ( {
41+ reflection : reflection . signatures [ 0 ] ,
42+ reflectionsTree,
43+ useArrow : true ,
44+ hideGenerics : true ,
45+ hideParamTypes : true ,
46+ hideReturns : true ,
47+ } )
48+ : reflection . name ;
4149 const type = "type" in reflection && typeof reflection . type !== "string" ? reflection . type : reflection ;
4250
4351 return (
4452 < tr className = "api-docs__table-row" key = { index } >
45- < td className = "api-docs__table-name" >
46- { reflection . name }
47- { isMethod ? callSignature : "" }
48- </ td >
49- < td className = "api-docs__table-type" >
50- < Code >
51- < Type { ...pageProps } reflection = { type } />
52- </ Code >
53- </ td >
53+ { isMethod ? (
54+ < td className = "api-docs__table-type" >
55+ < Code > { name } </ Code >
56+ </ td >
57+ ) : (
58+ < td className = "api-docs__table-name" > { name } </ td >
59+ ) }
60+ { ! hideType && (
61+ < td className = "api-docs__table-type" >
62+ < Code >
63+ < Type { ...pageProps } reflection = { type } />
64+ </ Code >
65+ </ td >
66+ ) }
5467 < td className = "api-docs__table-description" > { getCommentNode ( reflection ) } </ td >
5568 </ tr >
5669 ) ;
0 commit comments