Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ function setArrayElements (
) {
const field = values.field || getDecapitalized(interfaceName)
const description = values.description || field
if (shouldIgnore(description)) return
newElements.push(getApiElement(values.element, `{Object[]} ${field} ${description}`))
setInterfaceElements.call(this, matchedInterface, filename, newElements, values, field)
}
Expand Down Expand Up @@ -226,6 +227,7 @@ function setInterfaceElements (
const typeEnum = getPropTypeEnum(prop)
const propLabel = getPropLabel(typeEnum, propTypeName)
// Set the element
if (shouldIgnore(description)) return
newElements.push(getApiElement(values.element, `{${propLabel}} ${typeDef} ${description}`))

// If property is an object or interface then we need to also display the objects properties
Expand Down Expand Up @@ -261,6 +263,7 @@ function setNativeElements (
) {
const propLabel = getCapitalized(values.interface)
// Set the element
if (shouldIgnore(values.description)) return
newElements.push(getApiElement(values.element, `{${propLabel}} ${values.field} ${values.description}`))
return
}
Expand All @@ -287,6 +290,7 @@ function setObjectElements<NodeType extends ts.Node = ts.Node> (
if (!isUserDefinedProperty) return // We don't want to include default members in the docs

const documentationComments = property.compilerSymbol.getDocumentationComment(undefined).map((node) => node.text).join()
if (shouldIgnore(documentationComments)) return

const desc = documentationComments
? `\`${typeDef}.${propName}\` - ${documentationComments}`
Expand Down Expand Up @@ -507,3 +511,7 @@ function isUserDefinedSymbol (symbol: ts.Symbol): boolean {
const declarationFile = symbol.valueDeclaration.parent.getSourceFile()
return definitionFilesAddedByUser[declarationFile.fileName]
}

function shouldIgnore (description: string): boolean {
return !!description && ((description.match(/(\s|^)@private(\s|$)/) !== null) || (description.match(/(\s|^)@ignore(\s|$)/) !== null))
}