From fb637d92347917528e0955e291da5d07006f28e2 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Aug 2018 16:09:04 -0700 Subject: Make sure we don't render protected properties --- packages/react-docs/src/utils/typedoc_utils.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index 989485dfc..8ee76c98c 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -76,6 +76,9 @@ export class TypeDocUtils { public isProperty(entity: TypeDocNode): boolean { return entity.kindString === KindString.Property; } + public isUnderscorePrefixed(name: string): boolean { + return _.startsWith(name, '_'); + } public getModuleDefinitionsBySectionName(versionDocObj: TypeDocNode, configModulePaths: string[]): TypeDocNode[] { const moduleDefinitions: TypeDocNode[] = []; const jsonModules = versionDocObj.children; @@ -189,8 +192,7 @@ export class TypeDocUtils { case KindString.Function: if (entity.flags.isExported) { const funcName = (entity as TypeDocNode).signatures[0].name; - const isPublicFunc = !_.startsWith(funcName, '_'); - if (isPublicFunc) { + if (!this.isUnderscorePrefixed(funcName)) { const func = this._convertFunction(entity, sectionName, isClassOrObjectLiteral); docSection.functions.push(func); } @@ -198,7 +200,7 @@ export class TypeDocUtils { break; case KindString.Method: - if (entity.flags.isPublic) { + if (entity.flags.isPublic && !this.isUnderscorePrefixed(entity.name)) { isConstructor = false; const method = this._convertMethod(entity, isConstructor, sectionName); docSection.methods.push(method); @@ -206,8 +208,10 @@ export class TypeDocUtils { break; case KindString.Property: { - const property = this._convertProperty(entity, sectionName); - docSection.properties.push(property); + if (!this.isUnderscorePrefixed(entity.name)) { + const property = this._convertProperty(entity, sectionName); + docSection.properties.push(property); + } break; } -- cgit