diff --git a/src/model/class/class.ts b/src/model/class/class.ts index 8dfe822..bd7f9c4 100644 --- a/src/model/class/class.ts +++ b/src/model/class/class.ts @@ -6,7 +6,7 @@ import { OverviewNode } from './overview'; import { Type } from './type'; import { Param } from './param'; -export type ClassKind = 'component' | 'class' | 'service' | 'directive' | 'interface' | 'ng-module' | 'HOC'; +export type ClassKind = 'component' | 'class' | 'service' | 'directive' | 'interface' | 'ng-module' | 'HOC' | 'type' | 'enumeration'; export class Class { /** diff --git a/src/typedoc.parser/typedoc.parser.ts b/src/typedoc.parser/typedoc.parser.ts index 0cd4892..7eb6c1d 100644 --- a/src/typedoc.parser/typedoc.parser.ts +++ b/src/typedoc.parser/typedoc.parser.ts @@ -26,8 +26,8 @@ export class TypedocParser { this.findAllClasses(obj); return this.classes - .filter((item: any) => this.isClass(item) || this.isInterface(item)) - .filter((item: any) => item[CO.comment]) + .filter((item: any) => this.isClass(item) || this.isInterface(item) || this.isEnumeration(item) || this.isType(item)) + .filter((item: any) => item[CO.comment]) .map((item: any) => { if (item[CO.decorators]) { if (this.isComponent(item)) { @@ -42,6 +42,10 @@ export class TypedocParser { } else { if (this.isInterface(item)) { return this.parseClass(item, 'interface'); + } else if (this.isEnumeration(item)) { + return this.parseClass(item, 'enumeration'); + } else if (this.isType(item)) { + return this.parseClass(item, 'type'); } else { return this.parseClass(item, 'class'); } @@ -52,7 +56,7 @@ export class TypedocParser { findAllClasses(obj: any) { if (obj && obj[CO.children]) { obj[CO.children].forEach((item: any) => { - if (this.isClass(item) || this.isInterface(item)) { + if (this.isClass(item) || this.isInterface(item) || this.isEnumeration(item) || this.isType(item)) { this.classes.push(item); } else { this.findAllClasses(item); @@ -85,6 +89,14 @@ export class TypedocParser { return obj[CO.primKind] === 'Interface'; } + isEnumeration(obj: any) { + return obj[CO.primKind] === 'Enumeration'; + } + + isType(obj: any) { + return obj[CO.primKind] === 'Type alias'; + } + isComponent(obj: any) { return obj[CO.decorators][0][CO.name] === 'Component'; }