mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
fix(docgen): parsing constructor
This commit is contained in:
@@ -66,7 +66,7 @@ export class Documentation {
|
|||||||
switch (item.kind) {
|
switch (item.kind) {
|
||||||
case 'class': {
|
case 'class': {
|
||||||
this.classes.set(item.name, new DocumentedClass(item, config));
|
this.classes.set(item.name, new DocumentedClass(item, config));
|
||||||
items = items.filter((i) => i.longname !== item.longname);
|
items = items.filter((i) => i.longname !== item.longname || i.kind !== item.kind);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'function': {
|
case 'function': {
|
||||||
@@ -153,11 +153,17 @@ export class Documentation {
|
|||||||
path: dirname(member.sources?.[0]?.fileName ?? ''),
|
path: dirname(member.sources?.[0]?.fileName ?? ''),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (memberOf) info.push(`member of "${memberOf}"`);
|
if (memberOf) {
|
||||||
if (meta) info.push(`${join(meta.path, meta.file ?? '')}${meta.line ? `:${meta.line}` : ''}`);
|
info.push(`member of "${memberOf}"`);
|
||||||
|
}
|
||||||
|
if (meta) {
|
||||||
|
info.push(`${join(meta.path, meta.file ?? '')}${meta.line ? `:${meta.line}` : ''}`);
|
||||||
|
}
|
||||||
|
|
||||||
console.warn(`- "${name}"${info.length ? ` (${info.join(', ')})` : ''} has no accessible parent.`);
|
console.warn(`- "${name}"${info.length ? ` (${info.join(', ')})` : ''} has no accessible parent.`);
|
||||||
if (!name && !info.length) console.warn('Raw object:', member);
|
if (!name && !info.length) {
|
||||||
|
console.warn('Raw object:', member);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const it = items as ChildTypes[];
|
const it = items as ChildTypes[];
|
||||||
@@ -211,11 +217,17 @@ export class Documentation {
|
|||||||
? null
|
? null
|
||||||
: { file: member.meta.filename, line: member.meta.lineno, path: member.meta.path };
|
: { file: member.meta.filename, line: member.meta.lineno, path: member.meta.path };
|
||||||
|
|
||||||
if (memberof) info.push(`member of "${memberof as string}"`);
|
if (memberof) {
|
||||||
if (meta) info.push(`${join(meta.path, meta.file)}${meta.line ? `:${meta.line}` : ''}`);
|
info.push(`member of "${memberof as string}"`);
|
||||||
|
}
|
||||||
|
if (meta) {
|
||||||
|
info.push(`${join(meta.path, meta.file)}${meta.line ? `:${meta.line}` : ''}`);
|
||||||
|
}
|
||||||
|
|
||||||
console.warn(`- "${name}"${info.length ? ` (${info.join(', ')})` : ''} has no accessible parent.`);
|
console.warn(`- "${name}"${info.length ? ` (${info.join(', ')})` : ''} has no accessible parent.`);
|
||||||
if (!name && !info.length) console.warn('Raw object:', member);
|
if (!name && !info.length) {
|
||||||
|
console.warn('Raw object:', member);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,9 @@ export class DocumentedClass extends DocumentedItem<Class | DeclarationReflectio
|
|||||||
|
|
||||||
public add(item: DocumentedConstructor | DocumentedMethod | DocumentedMember | DocumentedEvent) {
|
public add(item: DocumentedConstructor | DocumentedMethod | DocumentedMember | DocumentedEvent) {
|
||||||
if (item instanceof DocumentedConstructor) {
|
if (item instanceof DocumentedConstructor) {
|
||||||
if (this.construct) throw new Error(`Doc ${this.data.name} already has constructor`);
|
if (this.construct) {
|
||||||
|
throw new Error(`Doc ${this.data.name} already has constructor`);
|
||||||
|
}
|
||||||
this.construct = item;
|
this.construct = item;
|
||||||
} else if (item instanceof DocumentedMethod) {
|
} else if (item instanceof DocumentedMethod) {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
|
|||||||
Reference in New Issue
Block a user