-
Notifications
You must be signed in to change notification settings - Fork 0
Description
This is a fix for a bug I discovered.
Background
I have been running classy for several weeks. It worked great. Loved the page formatting.
Then one day I noticed that it was no longer regenerating the documentation files.
I traced the problem to class DocletPage in static sign(doclet) at this line of code:
const source = doclet.yields || doclet.returns || [];
One of my files somehow causes source to be assigned to [ undefined ]. I did not backtrace how that happens, but it does.
Symptom
If the source array contains an undefined element, then the process terminates without printing any error.
Root Cause
I tracked the problem into this call to PublishUtils.typeStrings(), which itself calls helper functions with undefined.
const returns = source.map(s => s.type?.names).flat()
.map(s => PublishUtils.typeStrings({type: {names: [s]}})).join("|");
Fix
I changed the source array pre-processing to filter undefined elements using .filter(s => s):
const returns = source.filter(s => s).map(s => s.type?.names).flat()
.map(s => PublishUtils.typeStrings({type: {names: [s]}})).join("|");
With this change in place, jsdoc/classy properly generate the documentation files.