chore: cleanup code

This commit is contained in:
iCrawl
2022-10-11 09:36:36 +02:00
parent 7b7cc6fde4
commit c39faa94f6
4 changed files with 12 additions and 11 deletions

View File

@@ -33,7 +33,6 @@ export interface SidebarLayoutProps {
data: {
member: ReturnType<typeof findMember>;
members: ReturnType<typeof getMembers>;
searchIndex: any[];
source: MDXRemoteSerializeResult;
};
packageName: string;

View File

@@ -42,7 +42,6 @@ import { CmdKProvider } from '~/contexts/cmdK';
import { MemberProvider } from '~/contexts/member';
import { PACKAGES } from '~/util/constants';
import { findMember, findMemberByKey } from '~/util/model.server';
// import { miniSearch } from '~/util/search';
export const getStaticPaths: GetStaticPaths = async () => {
const pkgs = (
@@ -193,16 +192,19 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
containerKey = ApiFunction.getContainerKey(name, Number.parseInt(overloadIndex, 10));
}
const members = pkg
? getMembers(pkg, branchName).filter((item) => item.overloadIndex === null || item.overloadIndex <= 1)
: [];
const member =
memberName && containerKey ? findMemberByKey(model, packageName, containerKey, branchName) ?? null : null;
return {
props: {
packageName,
branchName,
data: {
members: pkg
? getMembers(pkg, branchName).filter((item) => item.overloadIndex === null || item.overloadIndex <= 1)
: [],
member:
memberName && containerKey ? findMemberByKey(model, packageName, containerKey, branchName) ?? null : null,
members,
member,
source: mdxSource,
},
},

View File

@@ -3,7 +3,6 @@ import {
type ApiPackage,
type ApiItem,
ApiItemKind,
ApiDocumentedItem,
type Excerpt,
ExcerptTokenKind,
ApiNameMixin,
@@ -11,6 +10,7 @@ import {
type ExcerptToken,
type Parameter,
type ApiFunction,
ApiDeclaredItem,
} from '@microsoft/api-extractor-model';
import type { DocNode, DocParagraph, DocPlainText } from '@microsoft/tsdoc';
import { type Meaning, ModuleSource } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
@@ -58,8 +58,8 @@ export function generatePath(items: readonly ApiItem[], version: string) {
return path.replace(/@discordjs\/(.*)\/(.*)?/, `$1/${version}/$2`);
}
export function resolveDocComment(item: ApiDocumentedItem) {
if (!(item instanceof ApiDocumentedItem)) {
export function resolveDocComment(item: ApiDeclaredItem) {
if (!(item instanceof ApiDeclaredItem)) {
return null;
}

View File

@@ -53,7 +53,7 @@ export function createApiModel(data: any) {
*
* @param item - The API item to resolve the summary text for.
*/
function tryResolveSummaryText(item: ApiDeclaredItem): string | null {
export function tryResolveSummaryText(item: ApiDeclaredItem): string | null {
if (!item.tsdocComment) {
return null;
}