question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] v1.1.14 breaking for @link reference

See original GitHub issue
Overview 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:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
YazeedFarescommented, Aug 2, 2021

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):

 if (typeof src !== 'string') {
    throw new Error('marked(): input parameter is of type '
      + Object.prototype.toString.call(src) + ', string expected');
  }

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:

<ref *1> [
  NodeObject {
    pos: 289,
    end: 299,
    flags: 4194304,
    modifierFlagsCache: 0,
    transformFlags: 0,
    parent: NodeObject {
      pos: 281,
      end: 299,
      flags: 4194304,
      modifierFlagsCache: 0,
      transformFlags: 0,
      parent: [NodeObject],
      kind: 320,
      tagName: [IdentifierObject],
      comment: [Circular *1]
    },
    kind: 313,
    text: 'some text'
  },
  pos: 289,
  end: 299,
  hasTrailingComma: false,
  transformFlags: 0
]
0reactions
marcovmuncommented, Nov 22, 2021

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> {

/**
 * Shortcut to {@link AbstractControl.dirty}
 */
public get dirty(): boolean | undefined {
    return true;
}

/**
 * Shortcut to {@link AbstractControl.touched}
 */
public get touched(): boolean | undefined {
    return false;
}

/**
 * The form control to use from the {@link FormGroup}
 *
 * @see https://angular.io/guide/reactive-forms
 */
public get ngControlName(): string | number | null {
    return ";
}

} ` 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)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug listing with status RESOLVED with resolution FIXED as at ...
configure" status:RESOLVED resolution:FIXED severity:normal · Bug:188 - "environment variable GZIP cause pilot-link-0.9.6.ebuild (kde) to fail ?
Read more >
514703 - Bug reference is not a link when linebreak between ...
Enter a comment that contains a bug reference at the end of a visual line, without typing any line breaks. I entered this...
Read more >
Mod compatibility thread & FAQ [Patch 1.14.0-f4] :: Cities
This guides you through how to handle it to ensure your city is safe. If you play with a lot of mods. Check...
Read more >
1.14.0 (July 7, 2020) - Envoy Proxy
http: fixing a bug in HTTP/1.0 responses where Connection: keep-alive was not appended for connections which were kept alive. http: http filter extensions...
Read more >
Changes & New Features | AutoHotkey
Fixed Case 2,,: to show an error message rather than crash. Fixed AltTab hotkeys [broken by v1.1.31.00]. Fixed hotstring X option to permit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found