mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
chore: run format
This commit is contained in:
@@ -413,7 +413,9 @@ export function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(
|
||||
default:
|
||||
for (const child of node.getChildNodes()) {
|
||||
const result = findPlainTextNode(child);
|
||||
if (result) return result;
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,13 +542,14 @@ export function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(
|
||||
) {
|
||||
for (const [index, key] of (apiItem as ApiClass | ApiInterface).typeParameters.entries() ?? []) {
|
||||
const typeParameter = extendsType.typeParameters?.[index];
|
||||
if (typeParameter)
|
||||
if (typeParameter) {
|
||||
mappedTypeParameters.set(key.name, { item: next.item as ApiDeclaredItem, range: typeParameter });
|
||||
else if (key.defaultTypeExcerpt)
|
||||
} else if (key.defaultTypeExcerpt) {
|
||||
mappedTypeParameters.set(key.name, {
|
||||
item: apiItem as ApiDeclaredItem,
|
||||
range: key.defaultTypeExcerpt.tokenRange,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -245,7 +245,10 @@ export class ApiPackage extends ApiItemContainerMixin(ApiNameMixin(ApiDocumented
|
||||
public static loadFromJson(rawJson: any, apiJsonFilename: string = ''): ApiPackage {
|
||||
const jsonObject =
|
||||
MinifyJSONMapping.metadata in rawJson ? this._mapFromMinified(rawJson) : (rawJson as IApiPackageJson);
|
||||
if (!jsonObject?.metadata) throw new Error(util.inspect(rawJson, { depth: 2 }));
|
||||
if (!jsonObject?.metadata) {
|
||||
throw new Error(util.inspect(rawJson, { depth: 2 }));
|
||||
}
|
||||
|
||||
if (!jsonObject?.metadata || typeof jsonObject.metadata.schemaVersion !== 'number') {
|
||||
throw new Error(
|
||||
`Error loading ${apiJsonFilename}:` +
|
||||
@@ -419,17 +422,19 @@ export class ApiPackage extends ApiItemContainerMixin(ApiNameMixin(ApiDocumented
|
||||
|
||||
private _mapToMinified(jsonObject: IApiPackageJson) {
|
||||
const mapper = (item: any): any => {
|
||||
if (Array.isArray(item)) return item.map(mapper);
|
||||
else {
|
||||
if (Array.isArray(item)) {
|
||||
return item.map(mapper);
|
||||
} else {
|
||||
const result: any = {};
|
||||
for (const key of Object.keys(item)) {
|
||||
if (key === 'dependencies') {
|
||||
result[MinifyJSONMapping.dependencies] = item.dependencies;
|
||||
} else if (key === 'tsdocConfig') {
|
||||
result[MinifyJSONMapping.tsdocConfig] = item.tsdocConfig;
|
||||
} else
|
||||
} else {
|
||||
result[MinifyJSONMapping[key as keyof typeof MinifyJSONMapping]] =
|
||||
typeof item[key] === 'object' ? mapper(item[key]) : item[key];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -441,20 +446,22 @@ export class ApiPackage extends ApiItemContainerMixin(ApiNameMixin(ApiDocumented
|
||||
|
||||
private static _mapFromMinified(jsonObject: any): IApiPackageJson {
|
||||
const mapper = (item: any): any => {
|
||||
if (Array.isArray(item)) return item.map(mapper);
|
||||
else {
|
||||
if (Array.isArray(item)) {
|
||||
return item.map(mapper);
|
||||
} else {
|
||||
const result: any = {};
|
||||
for (const key of Object.keys(item)) {
|
||||
if (key === MinifyJSONMapping.dependencies) {
|
||||
result.dependencies = item[MinifyJSONMapping.dependencies];
|
||||
} else if (key === MinifyJSONMapping.tsdocConfig) {
|
||||
result.tsdocConfig = item[MinifyJSONMapping.tsdocConfig];
|
||||
} else
|
||||
} else {
|
||||
result[
|
||||
Object.keys(MinifyJSONMapping).find(
|
||||
(look) => MinifyJSONMapping[look as keyof typeof MinifyJSONMapping] === key,
|
||||
)!
|
||||
] = typeof item[key] === 'object' ? mapper(item[key]) : item[key];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -489,22 +489,25 @@ export class Deserializer {
|
||||
},
|
||||
];
|
||||
|
||||
if (_class.extends)
|
||||
if (_class.extends) {
|
||||
excerptTokens.push({
|
||||
kind: ExcerptTokenKind.Reference,
|
||||
text: formatVarType(_class.extends) ?? '',
|
||||
canonicalReference: `${_package}!${getFirstType(_class.extends) ?? ''}:class`,
|
||||
});
|
||||
}
|
||||
|
||||
if (_class.extends && _class.implements)
|
||||
if (_class.extends && _class.implements) {
|
||||
excerptTokens.push({ kind: ExcerptTokenKind.Content, text: ' implements ' });
|
||||
}
|
||||
|
||||
if (_class.implements)
|
||||
if (_class.implements) {
|
||||
excerptTokens.push({
|
||||
kind: ExcerptTokenKind.Reference,
|
||||
text: formatVarType(_class.implements) ?? '',
|
||||
canonicalReference: `${_package}!${getFirstType(_class.implements) ?? ''}:class`,
|
||||
});
|
||||
}
|
||||
|
||||
members.push({
|
||||
members: classMembers,
|
||||
|
||||
Reference in New Issue
Block a user