Classes that are injectable often have constructors that should not be called by the application developer. It is the responsibility of the injector to instantiate the class and the constructor often contains private implementation details that may need to change. This commit removes constructors from the docs for API items that are both: a) Marked with an injectable decorator (e.g. Injectable, Directive, Component, Pipe), and b) Have no constructor description This second rule allows the developer to override the removal if there is something useful to say about the constructor. Note that "normal" classes such as `angimations/HttpHeaders` do not have their constructor removed, despite (at this time) having no description. PR Close #24529
		
			
				
	
	
		
			19 lines
		
	
	
		
			597 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			597 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| module.exports = function removeInjectableConstructors() {
 | |
|   return {
 | |
|     $runAfter: ['processing-docs', 'splitDescription'],
 | |
|     $runBefore: ['docs-processed'],
 | |
|     injectableDecorators: ['Injectable', 'Directive', 'Component', 'Pipe', 'NgModule'],
 | |
|     $process(docs) {
 | |
|       docs.forEach(doc => {
 | |
|         if (
 | |
|           doc.constructorDoc &&
 | |
|           !doc.constructorDoc.shortDescription &&
 | |
|           doc.decorators &&
 | |
|           doc.decorators.some(decorator => this.injectableDecorators.indexOf(decorator.name) !== -1)) {
 | |
|           delete doc.constructorDoc;
 | |
|         }
 | |
|       });
 | |
|     }
 | |
|   };
 | |
| };
 |