I'm working on a project that uses Angular libraries. To document the libraries, we are using CompoDocs. Things were working fine until I upgraded the libs from Angular 12.0.0.0 to Angular 12.2.2. Then doc generation was failing with this error:

Unhandled Rejection at: Promise { Error: marked(): input parameter is of type [object Array], string expected at marked (C:\my-lib\node_modules\marked\src\marked.js:27:11) at C:\my-lib\node_modules\@compodoc\compodoc\dist\index-cli-32a621dc.js:600:23 at arrayEach (C:\my-lib\node_modules\lodash\lodash.js:530:11) at Object.forEach (C:\my-lib\node_modules\lodash\lodash.js:9410:14) at markedtags (C:\my-lib\node_modules\@compodoc\compodoc\dist\index-cli-32a621dc.js:599:18) at ClassHelper.visitInputAndHostBinding (my-lib\node_modules\@compodoc\compodoc\dist\index-cli-32a621dc.js:7523:45) at ClassHelper.visitMembers (C:\my-lib\node_modules\@compodoc\compodoc\dist\index-cli-32a621dc.js:6859:34) at ClassHelper.visitClassDeclaration (C:\my-lib\node_modules\@compodoc\compodoc\dist\index-cli-32a621dc.js:6689:24) at my-lib\node_modules\@compodoc\compodoc\dist\index-cli-32a621dc.js:7965:63 at Array.reduce () } reason: Error: marked(): input parameter is of type [object Array], string expected at marked (my-lib\node_modules\marked\src\marked.js:27:11) at C:\my-lib\node_modules\@compodoc\compodoc\dist\index-cli-32a621dc.js:600:23 at arrayEach (C:\my-lib\node_modules\lodash\lodash.js:530:11) at Object.forEach (C:\my-lib\node_modules\lodash\lodash.js:9410:14) at markedtags (C:\my-lib\node_modules\@compodoc\compodoc\dist\index-cli-32a621dc.js:599:18) at ClassHelper.visitInputAndHostBinding (C:\my-lib\node_modules\@compodoc\compodoc\dist\index-cli-32a621dc.js:7523:45) at ClassHelper.visitMembers (C:\my-lib\node_modules\@compodoc\compodoc\dist\index-cli-32a621dc.js:6859:34) at ClassHelper.visitClassDeclaration (my-lib\node_modules\@compodoc\compodoc\dist\index-cli-32a621dc.js:6689:24) at my-lib\node_modules\@compodoc\compodoc\dist\index-cli-32a621dc.js:7965:63 at Array.reduce ()

Paths have been shortened to protect the innocent.

My solution was a lot of trial and error. It turns out the issue was with the @link. @link in compodocs allows us to link to a URL or some other place in the docs.

If I had two links within the same comment, things would fail, like this:

view plain print about
1/**
2 * See Also:
3 * <li> {@link my-interface}</li>
4 * <li> {@link my-class}</li>
5 */

It turns out the fix the issue was to add spaces after the opening curly bracket '{ ' and before the closing curly bracket, '}':

view plain print about
1/**
2 * See Also:
3 * <li> { @link my-interface }</li>
4 * <li> { @link my-class }</li>
5 */

Then the problem went away.