Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log('Writing ' + pageJsonPath);
const pageData: PageData = collectedData.pageDataByPageName.get(pageName)!;
const pageJson: IPageJson = { tables: [], name: pageName };
for (const apiItem of pageData.apiItems) {
switch (apiItem.kind) {
case ApiItemKind.Interface: {
pageJson.tables.push(createInterfacePageJson(collectedData, apiItem as ApiInterface));
break;
}
case ApiItemKind.Enum: {
pageJson.tables.push(createEnumPageJson(apiItem as ApiEnum));
break;
}
case ApiItemKind.Class: {
pageJson.tables.push(createClassPageJson(collectedData, apiItem as ApiClass));
break;
}
case ApiItemKind.TypeAlias: {
pageJson.tables.push(createTypeAliasPageJson(collectedData, apiItem as ApiTypeAlias));
break;
}
}
}
if (value.kind === 'References') {
referencesList.pages.push(value.pageName);
}
JsonFile.save(pageJson, pageJsonPath);
}
yamlItem.extends = [];
for (const extendsType of apiItem.extendsTypes) {
yamlItem.extends.push(this._linkToUidIfPossible(extendsType.excerpt.text));
}
}
const typeParameters: IYamlParameter[] = this._populateYamlTypeParameters(apiItem);
if (typeParameters.length) {
yamlItem.syntax = { typeParameters };
}
}
if (apiItem.tsdocComment) {
if (apiItem.tsdocComment.modifierTagSet.isSealed()) {
let sealedMessage: string;
if (apiItem.kind === ApiItemKind.Class) {
sealedMessage = 'This class is marked as `@sealed`. Subclasses should not extend it.';
} else {
sealedMessage = 'This interface is marked as `@sealed`. Other interfaces should not extend it.';
}
if (!yamlItem.remarks) {
yamlItem.remarks = sealedMessage;
} else {
yamlItem.remarks = sealedMessage + '\n\n' + yamlItem.remarks;
}
}
}
}
output.appendNode(
new DocParagraph({ configuration }, [
new DocEmphasisSpan({ configuration, bold: true}, [
new DocPlainText({ configuration, text: 'Signature:' })
])
])
);
output.appendNode(
new DocFencedCode({ configuration, code: apiItem.getExcerptWithModifiers(), language: 'typescript' })
);
}
}
let appendRemarks: boolean = true;
switch (apiItem.kind) {
case ApiItemKind.Class:
case ApiItemKind.Interface:
case ApiItemKind.Namespace:
case ApiItemKind.Package:
this._writeRemarksSection(output, apiItem);
appendRemarks = false;
break;
}
switch (apiItem.kind) {
case ApiItemKind.Class:
this._writeClassTables(output, apiItem as ApiClass);
break;
case ApiItemKind.Enum:
this._writeEnumTables(output, apiItem as ApiEnum);
break;
case ApiItemKind.Interface:
headerTitles: ['Type Alias', 'Description'],
});
const apiMembers: ReadonlyArray =
apiContainer.kind === ApiItemKind.Package
? (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);