Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] exported functions without name will break compodoc command #668

Closed
xmlking opened this issue Sep 30, 2018 · 1 comment
Closed

[BUG] exported functions without name will break compodoc command #668

xmlking opened this issue Sep 30, 2018 · 1 comment

Comments

@xmlking
Copy link

xmlking commented Sep 30, 2018

Overview of the issue

compodoc -p tsconfig.json -d docs will throw error with following code:

export default function(value) {
  const hexTable = [];
  for (let i = 0; i < 256; i++) {
    hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16);
  }

  const id = Object.keys(value.id).map(key => value.id[key]);

  let hexString = '';
  for (const el of id) {
    hexString += hexTable[el];
  }
  return hexString;
}
Errror
Unhandled Rejection at: Promise {
  <rejected> TypeError: Cannot read property 'text' of undefined
    at AngularDependencies.visitFunctionDeclaration (/projects/ngx-starter-kit/node_modules/@compodoc/compodoc/dist/index-cli.js:6959:31)
    at parseNode (/projects/ngx-starter-kit/node_modules/@compodoc/compodoc/dist/index-cli.js:6499:43)
sample test project:

https://github.com/xmlking/ngx-starter-kit
following files originally didn't have function name, and breaks with error:
https://github.com/xmlking/ngx-starter-kit/blob/develop/apps/api/src/core/entities/toHexString.ts
https://github.com/xmlking/ngx-starter-kit/blob/develop/tools/schematics/ngxs/index.ts

workaround

Add the function name

export default function toHexString(value) {
  const hexTable = [];
  for (let i = 0; i < 256; i++) {
    hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16);
  }

  const id = Object.keys(value.id).map(key => value.id[key]);

  let hexString = '';
  for (const el of id) {
    hexString += hexTable[el];
  }
  return hexString;
}
xmlking added a commit to xmlking/ngx-starter-kit that referenced this issue Sep 30, 2018
@vogloblinsky vogloblinsky changed the title exported functions without name will break compidoc command [BUG] exported functions without name will break compodoc command Oct 10, 2018
@vogloblinsky vogloblinsky added this to the 1.1.6 milestone Oct 10, 2018
xmlking added a commit to xmlking/ngx-starter-kit that referenced this issue Mar 6, 2019
@lock
Copy link

lock bot commented Sep 30, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. Why locking ? Having issues with the most up-to-date context.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants