[BUG] v1.1.14 breaking for @link reference
See original GitHub issueOverview of the issue
- This is inside of a Typescript NestJS project
- After updating to the latest version of compodoc, running throws the following error:
[13:22:45] found : schema
Unhandled Rejection at: Promise {
<rejected> Error: marked(): input parameter is of type [object Array], string expected
at marked (/Users/user/workspace/project/node_modules/marked/src/marked.js:27:11)
at /Users/user/workspace/project/node_modules/@compodoc/compodoc/dist/index-cli-32a621dc.js:600:23
at arrayEach (/Users/user/workspace/project/node_modules/lodash/lodash.js:530:11)
at Object.forEach (/Users/user/workspace/project/node_modules/lodash/lodash.js:9410:14)
at markedtags (/Users/user/workspace/project/node_modules/@compodoc/compodoc/dist/index-cli-32a621dc.js:599:18)
at AngularDependencies.visitFunctionDeclaration (/Users/user/workspace/project/node_modules/@compodoc/compodoc/dist/index-cli-32a621dc.js:9559:32)
at parseNode (/Users/user/workspace/project/node_modules/@compodoc/compodoc/dist/index-cli-32a621dc.js:8984:43)
at /Users/user/workspace/project/node_modules/@compodoc/compodoc/dist/index-cli-32a621dc.js:9260:13
at visitNodes (/Users/user/workspace/project/node_modules/@ts-morph/common/dist/typescript.js:29004:30)
at Object.forEachChild (/Users/user/workspace/project/node_modules/@ts-morph/common/dist/typescript.js:29243:24)
} reason: Error: marked(): input parameter is of type [object Array], string expected
at marked (/Users/user/workspace/project/node_modules/marked/src/marked.js:27:11)
at /Users/user/workspace/project/node_modules/@compodoc/compodoc/dist/index-cli-32a621dc.js:600:23
at arrayEach (/Users/user/workspace/project/node_modules/lodash/lodash.js:530:11)
at Object.forEach (/Users/user/workspace/project/node_modules/lodash/lodash.js:9410:14)
at markedtags (/Users/user/workspace/project/node_modules/@compodoc/compodoc/dist/index-cli-32a621dc.js:599:18)
at AngularDependencies.visitFunctionDeclaration (/Users/user/workspace/project/node_modules/@compodoc/compodoc/dist/index-cli-32a621dc.js:9559:32)
at parseNode (/Users/user/workspace/project/node_modules/@compodoc/compodoc/dist/index-cli-32a621dc.js:8984:43)
at /Users/user/workspace/project/node_modules/@compodoc/compodoc/dist/index-cli-32a621dc.js:9260:13
at visitNodes (/Users/user/workspace/project/node_modules/@ts-morph/common/dist/typescript.js:29004:30)
at Object.forEachChild (/Users/user/workspace/project/node_modules/@ts-morph/common/dist/typescript.js:29243:24)
[13:22:45] Sorry, but there was a problem during parsing or generation of the documentation. Please fill an issue on github. (https://github.com/compodoc/compodoc/issues/new)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project@0.4.0 compodoc: `compodoc -s`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@0.4.0 compodoc script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/user/.npm/_logs/2021-07-21T17_22_45_678Z-debug.log
(username and project path redacted)
After doing some testing, it appears due to @link
tags in our TSDoc comments, like the below:
/**
* A specific client for X usage
*
* @see Client interface: {@link Client}
*/
export class ClientChild implements Client {...}
We’ve been following usage from the TSDoc documentation for @link
.
Removing {@link Client}
allows compodoc to succeed. We’re seeing this happen for all @link
tags, not just on classes as well.
Additionally the same code and comments is parsed just fine on v1.1.13 and lower.
Operating System, Node.js, npm, compodoc version(s)
MacOS 11.4 Big Sur Node 14.17.0 NPM 6.14.13 Compodoc 1.1.14 NestJS 8.0.3
Compodoc installed globally or locally ?
Compodoc installed locally as a dev dependency
Motivation for or Use Case
VSCode picks up the @link
tag and is a useful tool!
Reproduce the error
add a @link
Related issues
Seems similar to https://github.com/compodoc/compodoc/issues/294 which was marked as fixed in this release
– Thanks so much for making compodoc, it’s an extremely useful tool and wanted to report this bug to help out! Please let me know if there’s any additional information I can provide or anything else I can do to help with this.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:11 (3 by maintainers)
Top GitHub Comments
marked.js is getting the comment (src) as an object rather than a string in our case, that’s why it is failing, the error is getting thrown in the following lines (line #26):
In our case if the same comment is used in multiple files the problem happens, I logged the received src in marked.js file and found it like this:
Tested with 1.1.15, Error still exist in our project. The three doc blocks that are responsible for the error: ` export class FormInputComponent<T> {
} ` This is a angular component. Running with: Node: 14.17.5 NPM: 6.14.14
Error log:
Unhandled Rejection at: Promise { <rejected> Error: marked(): input parameter is of type [object Array], string expected at marked (\node_modules\marked\src\marked.js:27:11) at ClassHelper.addAccessor (\node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:6799:52) at ClassHelper.visitMembers (\node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:7223:38) at ClassHelper.visitClassDeclaration (\node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:7015:24) at \node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:8318:63 at Array.reduce (<anonymous>) at ComponentHelper.getComponentIO (\node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:8315:33) at visitDecorator (\node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:9156:56) at Array.forEach (<anonymous>) at parseNode (\node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:9291:64) } reason: Error: marked(): input parameter is of type [object Array], string expected at marked (\node_modules\marked\src\marked.js:27:11) at ClassHelper.addAccessor (\node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:6799:52) at ClassHelper.visitMembers (\node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:7223:38) at ClassHelper.visitClassDeclaration (\node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:7015:24) at \node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:8318:63 at Array.reduce (<anonymous>) at ComponentHelper.getComponentIO (\node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:8315:33) at visitDecorator (\node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:9156:56) at Array.forEach (<anonymous>) at parseNode (\node_modules@compodoc\compodoc\dist\index-cli-8ef9c2ed.js:9291:64)