Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _initApiItemsByTypeNameRecursive(apiItem: ApiItem, ambiguousNames: Set): void {
switch (apiItem.kind) {
case ApiItemKind.Class:
case ApiItemKind.Enum:
case ApiItemKind.Interface:
// Attempt to register both the fully qualified name and the short name
const namesForType: string[] = [apiItem.displayName];
// Note that nameWithDot cannot conflict with apiItem.name (because apiItem.name
// cannot contain a dot)
const nameWithDot: string | undefined = this._getTypeNameWithDot(apiItem);
if (nameWithDot) {
namesForType.push(nameWithDot);
}
// Register all names
for (const typeName of namesForType) {
if (ambiguousNames.has(typeName)) {
break;
}
function collectPageData(collectedData: CollectedData, apiItem: ApiItem, kind: PageKind): void {
if (apiItem instanceof ApiDocumentedItem) {
switch (apiItem.kind) {
case ApiItemKind.Interface:
case ApiItemKind.Enum:
case ApiItemKind.Class:
case ApiItemKind.TypeAlias: {
console.log('Analyzing ' + apiItem.displayName);
if (apiItem.tsdocComment !== undefined) {
const docCategoryTag: DocInlineTag | undefined = findInlineTagByName('@docCategory', apiItem.tsdocComment);
if (docCategoryTag !== undefined) {
const pageName: string = docCategoryTag.tagContent.trim();
let pageData: PageData | undefined = collectedData.pageDataByPageName.get(pageName);
if (pageData === undefined) {
collectedData.pageDataByPageName.set(pageName, new PageData(pageName, 'References'));
pageData = collectedData.pageDataByPageName.get(pageName);
collectedData.apiToPage.set(apiItem.displayName, { pageName, kind: 'References' });
} else {
private _writeApiItemPage(apiItem: ApiItem): void {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const output: DocSection = new DocSection({ configuration: this._tsdocConfiguration });
this._writeBreadcrumb(output, apiItem);
const scopedName: string = apiItem.getScopedNameWithinPackage();
switch (apiItem.kind) {
case ApiItemKind.Class:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} class` }));
break;
case ApiItemKind.Enum:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} enum` }));
break;
case ApiItemKind.Interface:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} interface` }));
break;
case ApiItemKind.Constructor:
case ApiItemKind.ConstructSignature:
output.appendNode(new DocHeading({ configuration, title: scopedName }));
break;
case ApiItemKind.Method:
case ApiItemKind.MethodSignature:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} method` }));
break;
case ApiItemKind.Function:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} function` }));
break;
? (apiContainer as ApiPackage).entryPoints[0].members
: (apiContainer as ApiNamespace).members;
for (const apiMember of apiMembers) {
const row: DocTableRow = new DocTableRow({ configuration }, [
this._createTitleCell(apiMember),
this._createDescriptionCell(apiMember),
]);
switch (apiMember.kind) {
case ApiItemKind.Class:
classesTable.addRow(row);
this._writeApiItemPage(apiMember);
break;
case ApiItemKind.Enum:
enumerationsTable.addRow(row);
this._writeApiItemPage(apiMember);
break;
case ApiItemKind.Interface:
interfacesTable.addRow(row);
this._writeApiItemPage(apiMember);
break;
case ApiItemKind.Namespace:
namespacesTable.addRow(row);
this._writeApiItemPage(apiMember);
break;
case ApiItemKind.Function:
functionsTable.addRow(row);