11import { DocCollection , Processor } from 'dgeni' ;
22import { MethodMemberDoc } from 'dgeni-packages/typescript/api-doc-types/MethodMemberDoc' ;
3- import { getDirectiveMetadata } from '../common/directive-metadata' ;
43import {
5- decorateDeprecatedDoc , getDirectiveSelectors , isDirective , isMethod , isNgModule , isProperty ,
6- isService
4+ decorateDeprecatedDoc ,
5+ getDirectiveSelectors ,
6+ isDirective ,
7+ isMethod ,
8+ isNgModule ,
9+ isProperty ,
10+ isService ,
711} from '../common/decorators' ;
812import {
9- CategorizedClassDoc , CategorizedClassLikeDoc , CategorizedMethodMemberDoc ,
10- CategorizedPropertyMemberDoc
13+ CategorizedClassDoc ,
14+ CategorizedClassLikeDoc ,
15+ CategorizedFunctionExportDoc ,
16+ CategorizedMethodMemberDoc ,
17+ CategorizedPropertyMemberDoc ,
1118} from '../common/dgeni-definitions' ;
12- import { normalizeMethodParameters } from '../common/normalize-method-parameters' ;
19+ import { getDirectiveMetadata } from '../common/directive-metadata' ;
20+ import { normalizeFunctionParameters } from '../common/normalize-function-parameters' ;
1321import { getInputBindingData , getOutputBindingData } from '../common/property-bindings' ;
1422import { sortCategorizedMembers } from '../common/sort-members' ;
1523
@@ -30,6 +38,10 @@ export class Categorizer implements Processor {
3038 docs
3139 . filter ( doc => doc . docType === 'class' || doc . docType === 'interface' )
3240 . forEach ( doc => this . decorateClassLikeDoc ( doc ) ) ;
41+
42+ docs
43+ . filter ( doc => doc . docType === 'function' )
44+ . forEach ( doc => this . decorateFunctionExportDoc ( doc ) ) ;
3345 }
3446
3547 /**
@@ -92,11 +104,17 @@ export class Categorizer implements Processor {
92104 * will be normalized, so that they can be easily used inside of dgeni templates.
93105 */
94106 private decorateMethodDoc ( methodDoc : CategorizedMethodMemberDoc ) {
95- normalizeMethodParameters ( methodDoc ) ;
107+ normalizeFunctionParameters ( methodDoc ) ;
96108 decorateDeprecatedDoc ( methodDoc ) ;
109+ }
97110
98- // Mark methods with a `void` return type so we can omit show the return type in the docs.
99- methodDoc . showReturns = methodDoc . type ? methodDoc . type !== 'void' : false ;
111+ /**
112+ * Method that will be called for each function export doc. The parameters for the functions
113+ * will be normalized, so that they can be easily used inside of Dgeni templates.
114+ */
115+ private decorateFunctionExportDoc ( functionDoc : CategorizedFunctionExportDoc ) {
116+ normalizeFunctionParameters ( functionDoc ) ;
117+ decorateDeprecatedDoc ( functionDoc ) ;
100118 }
101119
102120 /**
0 commit comments