Typedoc: TypeDoc error: ts.isIdentifierOrPrivateIdentifier is not a function

Created on 21 Mar 2020  ยท  10Comments  ยท  Source: TypeStrong/typedoc

Expected Behavior


TypeDoc should generate new documentation for the files in the src directory.

Actual Behavior


TypeDoc throws an error saying:

E:\Coding\nodejs\bot-generator>typedoc --out docs src

Using TypeScript 3.7.4 from E:\Coding\nodejs\bot-generator\node_modules\typescript\lib
E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\converter\context.js:194
    return node['name'] && (ts.isIdentifierOrPrivateIdentifier(node['name']) ||
                               ^

TypeError: ts.isIdentifierOrPrivateIdentifier is not a function
    at isNamedNode (E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\converter\context.
js:194:32)
    at Context.getSymbolAtLocation (E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\co
nverter\context.js:47:24)
    at Object.createDeclaration (E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\conve
rter\factories\declaration.js:61:32)
    at ClassConverter.convert (E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\convert
er\nodes\class.js:28:34)
    at Converter.convertNode (E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\converte
r\converter.js:116:53)
    at E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\converter\nodes\block.js:58:32
    at Array.forEach (<anonymous>)
    at BlockConverter.convertStatements (E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\l
ib\converter\nodes\block.js:56:29)
    at E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\converter\nodes\block.js:43:26
    at Context.withScope (E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\converter\co
ntext.js:108:9)

Steps to reproduce the bug


- Install TypeDoc using either local or global installation npm install typedoc --save-dev or npm install typedoc --global (I tried both of them).
- Run typedoc --out docs src (I also tried using a config file, which led to the same error)

Environment

  • Typedoc version: 0.17.1
  • Node.js version: v12.12.0
  • OS: Windows 10 1903
no bug

Most helpful comment

TypeScript 3.7.4

This is your issue. You ignored the warning about incompatible peer dependencies. You'll need to use an older version of TypeDoc or install a newer version of TypeScript for your project.

warning " > [email protected]" has incorrect peer dependency "typescript@>=3.8.3".

All 10 comments

TypeScript 3.7.4

This is your issue. You ignored the warning about incompatible peer dependencies. You'll need to use an older version of TypeDoc or install a newer version of TypeScript for your project.

warning " > [email protected]" has incorrect peer dependency "typescript@>=3.8.3".

Okay I updated to the latest typescript version and now I'm getting this error:

E:\Coding\nodejs\bot-generator>typedoc --out docs src

Using TypeScript 3.8.3 from E:\Coding\nodejs\bot-generator\node_modules\typescript\lib
Rendering [----------------------------------------] 0%E:\Coding\nodejs\bot-generator\node_modules\
marked\src\marked.js:111
    throw e;
    ^

TypeError: this.renderer.html is not a function
Please report this to https://github.com/markedjs/marked.
    at InlineLexer.output (E:\Coding\nodejs\bot-generator\node_modules\marked\src\InlineLexer.js:85
:30)
    at Parser.tok (E:\Coding\nodejs\bot-generator\node_modules\marked\src\Parser.js:97:36)
    at Parser.parse (E:\Coding\nodejs\bot-generator\node_modules\marked\src\Parser.js:47:19)
    at Function.parse (E:\Coding\nodejs\bot-generator\node_modules\marked\src\Parser.js:30:19)
    at marked (E:\Coding\nodejs\bot-generator\node_modules\marked\src\marked.js:103:19)
    at MarkedPlugin.onParseMarkdown (E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\o
utput\plugins\MarkedPlugin.js:115:28)
    at E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\utils\events.js:259:33
    at triggerApi (E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\utils\events.js:110
:13)
    at Renderer.trigger (E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\utils\events.
js:252:13)
    at MarkedPlugin.parseMarkdown (E:\Coding\nodejs\bot-generator\node_modules\typedoc\dist\lib\out
put\plugins\MarkedPlugin.js:87:20)

Looks like Marked broke in 0.8.1 - https://github.com/markedjs/marked/issues/1621 and since it was a patch version it was automatically pulled in.

Do you have a HTML comment in a heading somewhere? Removing that should fix this until Marked publishes a fix.

I couldn't find any HTML comments.
I searched for characters such as - and # but I can't find anything that resembles markdown or HTML.

Edit: Is there anything I'm missing?

Hard to say, TypeDoc also reads your README.md file, so if that has HTML in it it might break. I'll publish 0.17.2 shortly pinning marked to 0.8.0 until they fix this issue.

After removing all content from README.md it suddenly works.
Thank you for your support.

0.17.2 published, if you upgrade to that your original readme should work :)

Awesome, problem fixed.
Thanks!

You ignored the warning about incompatible peer dependencies.

@Gerrit0 not necessarily user error. There doesn't seem to be a warning for the peer deps when installing:

โœญ yarn add -D typedoc
yarn add v1.16.0
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning " > [email protected]" has unmet peer dependency "webpack@^4.4.0".
warning " > [email protected]" has unmet peer dependency "webpack@>=4.41.1".
warning "react-pose > popmotion-pose > pose-core > [email protected]" has unmet peer dependency "rollup@>=1.26.3".
warning " > [email protected]" has unmet peer dependency "react-router@^5.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0".
warning " > [email protected]" has unmet peer dependency "jest@>22".
warning " > [email protected]" has unmet peer dependency "webpack@^4.3.0".
warning " > [email protected]" has unmet peer dependency "jest@>=24 <25".
warning " > [email protected]" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
[4/4] ๐Ÿ”จ  Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
โ””โ”€ [email protected]
info All dependencies
โ””โ”€ [email protected]
โœจ  Done in 12.59s.

Yet it still fails:

โœญ yarn typedoc --out api-docs src
yarn run v1.16.0
$ ./frontend/node_modules/.bin/typedoc --out api-docs src

Using TypeScript 3.7.5 from ./frontend/node_modules/typescript/lib
./frontend/node_modules/typedoc/dist/lib/converter/context.js:194
    return node['name'] && (ts.isIdentifierOrPrivateIdentifier(node['name']) ||
                               ^

TypeError: ts.isIdentifierOrPrivateIdentifier is not a function
...

When I add a specific version, or re-install, then it warns:

โœญ yarn add -D [email protected]
yarn add v1.16.0
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning " > [email protected]" has unmet peer dependency "webpack@^4.4.0".
warning " > [email protected]" has unmet peer dependency "webpack@>=4.41.1".
warning "react-pose > popmotion-pose > pose-core > [email protected]" has unmet peer dependency "rollup@>=1.26.3".
warning " > [email protected]" has unmet peer dependency "react-router@^5.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0".
warning " > [email protected]" has unmet peer dependency "jest@>22".
warning " > [email protected]" has unmet peer dependency "webpack@^4.3.0".
warning " > [email protected]" has unmet peer dependency "jest@>=24 <25".
warning " > [email protected]" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
warning " > [email protected]" has incorrect peer dependency "typescript@>=3.8.3".
[4/4] ๐Ÿ”จ  Building fresh packages...
success Saved lockfile.
success Saved 9 new dependencies.
info Direct dependencies
โ””โ”€ [email protected]
info All dependencies
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ””โ”€ [email protected]
โœจ  Done in 13.51s.

That looks like a bug with yarn ^
I'd be open to a PR that adds TS version checking before trying to convert the project to warn the user.

Was this page helpful?
0 / 5 - 0 ratings