@@ -33,7 +33,7 @@ const mapInterfaceName2deps = {
3333} ;
3434
3535const assureMemberAsMap = ( o , field ) => o [ field ] || ( o [ field ] = { extends : { } , inheritedBy : { } } ) ;
36-
36+ const assureInit = ( o , field , defaultValue = { } ) => o [ field ] || ( o [ field ] = defaultValue ) ;
3737/**
3838 * Prints out particular nodes from a source file
3939 *
@@ -80,7 +80,7 @@ extract( "node_modules/typescript/lib/lib.dom.d.ts" );
8080const interfaces = Object . keys ( mapInterfaceName2deps ) ;
8181// console.log( mapInterfaceName2deps );
8282const member2commentCount = { } ;
83-
83+ const member2types = { } ;
8484
8585function scanMembers ( dep )
8686{
@@ -89,14 +89,20 @@ function scanMembers( dep )
8989 const name = getNodeName ( node ) ;
9090 if ( ! name )
9191 return ;
92- const txt = node . getText ( sourceFile ) . replace ( 'readonly ' , '' ) ;
92+ // const txt = node.getText(sourceFile).replace('readonly ','');
9393 const symbol = checker . getSymbolAtLocation ( node . name ) ;
9494 const comment = ts . displayPartsToString ( symbol . getDocumentationComment ( checker ) ) . trim ( ) ;
95- if ( ! member2commentCount [ txt ] ) // assureMemberAsMap(member2commentCount,txt)[comment] )
96- member2commentCount [ txt ] = { } ;
97- if ( ! member2commentCount [ txt ] [ comment ] )
98- member2commentCount [ txt ] [ comment ] = 0 ;
99- member2commentCount [ txt ] [ comment ] ++ ;
95+ const m2c = assureInit ( member2commentCount , name , { } ) ;
96+ assureInit ( m2c , comment , 0 ) ;
97+ m2c [ comment ] ++ ;
98+
99+ const m2t = assureInit ( member2types , name , { } ) ;
100+ const tt = node ?. type ?. types || [ ] ;
101+ tt . map ( n =>
102+ { const t = n . getText ( ) ;
103+ assureInit ( m2t , t , 0 ) ;
104+ m2t [ t ] ++ ;
105+ } ) ;
100106
101107 // get comments
102108 // const commentRanges = ts.getLeadingCommentRanges(
0 commit comments