Add --excludePrivate option (#293)
This commit is contained in:
@@ -71,6 +71,9 @@ in order to change the behaviour of TypeDoc.
|
||||
Define a pattern for files that should be considered being external.
|
||||
* `--excludeExternals`<br>
|
||||
Prevent externally resolved TypeScript files from being documented.
|
||||
* `--excludePrivate`<br>
|
||||
Prevent private members from being included in the generated documentation.
|
||||
|
||||
|
||||
#### TypeScript compiler
|
||||
* `--module <commonjs, amd, system or umd>`<br>
|
||||
|
||||
@@ -4,11 +4,19 @@ import {Reflection, ReflectionKind, DeclarationReflection} from "../../models/in
|
||||
import {createDeclaration} from "../factories/index";
|
||||
import {Context} from "../context";
|
||||
import {Component, ConverterNodeComponent} from "../components";
|
||||
import {ParameterType} from "../../utils/options/declaration";
|
||||
import {Option} from "../../utils/component";
|
||||
|
||||
|
||||
@Component({name:'node:class'})
|
||||
export class ClassConverter extends ConverterNodeComponent<ts.ClassDeclaration>
|
||||
{
|
||||
@Option({
|
||||
name: "excludePrivate",
|
||||
help: 'Ignores private variables and methods',
|
||||
type: ParameterType.Boolean
|
||||
})
|
||||
excludePrivate:boolean;
|
||||
/**
|
||||
* List of supported TypeScript syntax kinds.
|
||||
*/
|
||||
@@ -36,7 +44,12 @@ export class ClassConverter extends ConverterNodeComponent<ts.ClassDeclaration>
|
||||
context.withScope(reflection, node.typeParameters, () => {
|
||||
if (node.members) {
|
||||
node.members.forEach((member) => {
|
||||
this.owner.convertNode(context, member);
|
||||
const privateMember = (member.flags & ts.NodeFlags.Private) > 0;
|
||||
const exclude = this.excludePrivate ? privateMember : false;
|
||||
|
||||
if (!exclude) {
|
||||
this.owner.convertNode(context, member);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user