refactor: reset state and code cleanup

This commit is contained in:
iCrawl
2022-08-23 02:38:53 +02:00
parent 6062d361fb
commit 434f696397
24 changed files with 94 additions and 89 deletions

View File

@@ -6,9 +6,7 @@ import { TSDoc } from './tsdoc/TSDoc';
import type { ApiMethodJSON, ApiMethodSignatureJSON } from '~/DocModel/ApiNodeJSONEncoder';
import { Visibility } from '~/DocModel/Visibility';
type MethodResolvable = ApiMethodJSON | ApiMethodSignatureJSON;
function getShorthandName(data: MethodResolvable) {
function getShorthandName(data: ApiMethodJSON | ApiMethodSignatureJSON) {
return `${data.name}${data.optional ? '?' : ''}(${data.parameters.reduce((prev, cur, index) => {
if (index === 0) {
return `${prev}${cur.isOptional ? `${cur.name}?` : cur.name}`;
@@ -18,7 +16,7 @@ function getShorthandName(data: MethodResolvable) {
}, '')})`;
}
export function MethodItem({ data }: { data: MethodResolvable }) {
export function MethodItem({ data }: { data: ApiMethodJSON | ApiMethodSignatureJSON }) {
const method = data as ApiMethodJSON;
return (