( doc: ClassLikeExportDoc, exportSymbolsToDocsMap: Map<ts.Symbol, ClassLikeExportDoc>, )
| 29 | |
| 30 | /** Gets all class like export documents which the given doc inherits from. */ |
| 31 | export function getInheritedDocsOfClass( |
| 32 | doc: ClassLikeExportDoc, |
| 33 | exportSymbolsToDocsMap: Map<ts.Symbol, ClassLikeExportDoc>, |
| 34 | ): ClassLikeExportDoc[] { |
| 35 | const result: ClassLikeExportDoc[] = []; |
| 36 | const typeChecker = doc.typeChecker; |
| 37 | for (let info of doc.extendsClauses) { |
| 38 | if (info.doc) { |
| 39 | result.push(info.doc, ...getInheritedDocsOfClass(info.doc, exportSymbolsToDocsMap)); |
| 40 | } else if (info.type) { |
| 41 | // If the heritage info has not been resolved to a Dgeni API document, we try to |
| 42 | // interpret the type expression and resolve/create corresponding Dgeni API documents. |
| 43 | // An example is the use of mixins. Type-wise mixins are not like real classes, because |
| 44 | // they are composed through an intersection type. In order to handle this pattern, we |
| 45 | // need to handle intersection types manually and resolve them to Dgeni API documents. |
| 46 | const resolvedType = typeChecker.getTypeAtLocation(info.type); |
| 47 | const docs = getClassLikeDocsFromType(resolvedType, doc, exportSymbolsToDocsMap); |
| 48 | // Add direct class-like types resolved from the expression. |
| 49 | result.push(...docs); |
| 50 | // Resolve inherited docs of the resolved documents. |
| 51 | docs.forEach(d => result.push(...getInheritedDocsOfClass(d, exportSymbolsToDocsMap))); |
| 52 | } |
| 53 | } |
| 54 | return result; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Gets all class-like Dgeni documents from the given type. e.g. intersection types of |
no test coverage detected
searching dependent graphs…