Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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.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;
case ApiItemKind.Namespace:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} namespace` }));
break;
case ApiItemKind.Package:
const unscopedPackageName: string = PackageName.getUnscopedName(apiItem.displayName);
console.log(apiItem.displayName);
output.appendNode(new DocHeading({ configuration, title: `${unscopedPackageName} package` }));
break;
case ApiItemKind.Property:
case ApiItemKind.PropertySignature:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} property` }));
break;
case ApiItemKind.TypeAlias:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} type` }));
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;
case ApiItemKind.Model:
output.appendNode(new DocHeading({ configuration, title: `API Reference` }));
break;
case ApiItemKind.Namespace:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} namespace` }));
break;
case ApiItemKind.Package:
console.log(`Writing ${apiItem.displayName} package`);
const unscopedPackageName: string = PackageName.getUnscopedName(apiItem.displayName);
output.appendNode(new DocHeading({ configuration, title: `${unscopedPackageName} package` }));
break;
case ApiItemKind.Property:
case ApiItemKind.PropertySignature:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} property` }));
collectedData,
apiMethodSignature.excerptTokens,
apiMethodSignature.excerpt.tokenRange
);
if (apiMethodSignature.tsdocComment) {
if (apiMethodSignature.tsdocComment.deprecatedBlock) {
tableRowJson.deprecated = true;
}
tableRowJson.description += renderDocNodeWithoutInlineTag(apiMethodSignature.tsdocComment.summarySection);
}
interfaceTableRowJson.push(tableRowJson);
break;
}
case ApiItemKind.Function: {
break;
}
case ApiItemKind.Class: {
break;
}
}
}
tableJson.members = interfaceTableRowJson;
return tableJson;
}
case ApiItemKind.Package:
yamlItem.type = 'package';
break;
case ApiItemKind.Property:
case ApiItemKind.PropertySignature:
const apiProperty: ApiPropertyItem = apiItem as ApiPropertyItem;
if (apiProperty.isEventProperty) {
yamlItem.type = 'event';
} else {
yamlItem.type = 'property';
}
this._populateYamlProperty(yamlItem, apiProperty);
break;
case ApiItemKind.Function:
yamlItem.type = 'function';
this._populateYamlFunctionLike(yamlItem, apiItem as ApiFunction);
break;
default:
throw new Error('Unimplemented item kind: ' + apiItem.kind);
}
if (apiItem.kind !== ApiItemKind.Package && !this._shouldEmbed(apiItem.kind)) {
const associatedPackage: ApiPackage | undefined = apiItem.getAssociatedPackage();
if (!associatedPackage) {
throw new Error('Unable to determine associated package for ' + apiItem.displayName);
}
yamlItem.package = this._getUid(associatedPackage);
}