@@ -19,7 +19,7 @@ function getInheritedFrom(declaration: ts.Declaration, currentClassName: string)
1919 if ( parentName === currentClassName ) {
2020 return undefined ;
2121 }
22- return { name : parentName + '.' + declaration . name . getText ( ) } ;
22+ return { className : parentName , methodName : declaration . name . getText ( ) } ;
2323}
2424
2525function getDefaultValue ( declaration : ts . Declaration ) {
@@ -35,7 +35,8 @@ function getDefaultValue(declaration: ts.Declaration) {
3535export default function extractDocumentation (
3636 sourceFile : ts . SourceFile ,
3737 checker : ts . TypeChecker ,
38- extraExports : Array < string >
38+ extraExports : Array < string > ,
39+ includeCoreMethods : boolean
3940) : Array < TestUtilsDoc > {
4041 const moduleSymbol = checker . getSymbolAtLocation ( sourceFile ) ;
4142 if ( ! moduleSymbol ) {
@@ -51,7 +52,7 @@ export default function extractDocumentation(
5152 continue ;
5253 }
5354 const classType = checker . getDeclaredTypeOfSymbol ( symbol ) ;
54- documentClass ( definitions , symbol , classType , checker ) ;
55+ documentClass ( definitions , symbol , classType , checker , includeCoreMethods ) ;
5556 }
5657
5758 return Array . from ( definitions . values ( ) ) ;
@@ -61,7 +62,8 @@ function documentClass(
6162 definitions : Map < string , TestUtilsDoc > ,
6263 symbol : ts . Symbol ,
6364 classType : ts . Type ,
64- checker : ts . TypeChecker
65+ checker : ts . TypeChecker ,
66+ includeCoreMethods : boolean
6567) {
6668 if ( ! classType . isClass ( ) ) {
6769 throw new Error ( `Exported symbol is not a class, got ${ checker . symbolToString ( symbol ) } ` ) ;
@@ -92,11 +94,20 @@ function documentClass(
9294 maybeReturnType . flags & ts . TypeFlags . Void ? maybeReturnType : maybeReturnType . getNonNullableType ( ) ;
9395 const dependency = findDependencyType ( returnType , checker ) ;
9496 if ( dependency && ! definitions . has ( dependency . typeName ) ) {
95- documentClass ( definitions , dependency . symbol , dependency . type , checker ) ;
97+ documentClass ( definitions , dependency . symbol , dependency . type , checker , includeCoreMethods ) ;
9698 }
9799
98100 const { typeName, typeParameters } = extractTypeArguments ( returnType , checker ) ;
99101
102+ const inheritedFrom = getInheritedFrom ( declaration , className ) ;
103+ if (
104+ inheritedFrom &&
105+ ! includeCoreMethods &&
106+ [ 'AbstractWrapper' , 'ElementWrapper' ] . includes ( inheritedFrom ?. className )
107+ ) {
108+ continue ;
109+ }
110+
100111 definition . methods . push ( {
101112 name : property . getName ( ) ,
102113 description : getDescription ( property . getDocumentationComment ( checker ) , declaration ) . text ,
@@ -117,7 +128,7 @@ function documentClass(
117128 defaultValue : getDefaultValue ( extractDeclaration ( parameter ) ) ,
118129 } ;
119130 } ) ,
120- inheritedFrom : getInheritedFrom ( declaration , className ) ,
131+ inheritedFrom : inheritedFrom ? { name : ` ${ inheritedFrom . className } . ${ inheritedFrom . methodName } ` } : undefined ,
121132 } ) ;
122133 }
123134 }
0 commit comments