You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running typedoc fails with the following stack trace:
Using TypeScript 3.7.5 from node_modules/typescript/lib
node_modules/typedoc/dist/lib/converter/nodes/class.js:65
&& typeToInheritFrom.symbol.declarations.forEach((declaration) => {
^
TypeError: Cannot read property 'forEach' of undefined
at typesToInheritFrom.forEach (node_modules/typedoc/dist/lib/converter/nodes/class.js:65:70)
at Array.forEach (<anonymous>)
at context.withScope (node_modules/typedoc/dist/lib/converter/nodes/class.js:62:40)
at Context.withScope (node_modules/typedoc/dist/lib/converter/context.js:101:9)
at ClassConverter.convert (node_modules/typedoc/dist/lib/converter/nodes/class.js:33:17)
at Converter.convertNode (node_modules/typedoc/dist/lib/converter/converter.js:116:53)
at Context.inherit (node_modules/typedoc/dist/lib/converter/context.js:140:24)
at typeToInheritFrom.symbol.typeToInheritFrom.symbol.declarations.forEach (node_modules/typedoc/dist/lib/converter/nodes/class.js:66:37)
at Array.forEach (<anonymous>)
at typesToInheritFrom.forEach (node_modules/typedoc/dist/lib/converter/nodes/class.js:65:70)
The issue is caused by this code, reproduced here with slightly different formatting:
typesToInheritFrom.forEach((typeToInheritFrom)=>{typeToInheritFrom.symbol&&typeToInheritFrom.symbol.declarations// <--- Make sure this is defined&&typeToInheritFrom.symbol.declarations.forEach((declaration)=>{context.inherit(declaration,baseType.typeArguments);});});
then documentation is generated normally. I have not studied the code long enough to understand its intent, so I'm unsure if this change is the best approach.
This failure did not occur in my project until I started using mixins. Additionally, the code above was added in a PR to introduce mixin support.
Due to an issue[1] in typedoc's mixin support,
the documentation generation phase of the
release process fails.
This commit points the typedoc dependency to a
custom fork[2] that contains a fix. We can and
should back this change out later when
mainline is fixed.
[1] TypeStrong/typedoc#1207
[2] https://github.com/zslayton/typedoc/
This is really weird, my first instinct was that typeToInheritFrom.symbol was an internal definition that we used and thus couldn't rely on TS's declaration file for accurate types, but this doesn't seem to be the case.
I really don't want to add checks for undefined when the TS declaration file claims it will never be undefined, but maybe the TS types are just wrong here? Looking more deeply into it.
I'm beginning to think this is a TS bug... I've tried to reduce it to a smaller example but haven't been able to. For now I'll just merge the PR with a note that this is really weird and needs further investigation.
I have a Typescript codebase that employs mixins.
Running
typedoc
fails with the following stack trace:The issue is caused by this code, reproduced here with slightly different formatting:
If I change it to:
then documentation is generated normally. I have not studied the code long enough to understand its intent, so I'm unsure if this change is the best approach.
This failure did not occur in my project until I started using mixins. Additionally, the code above was added in a PR to introduce mixin support.
Expected Behavior
Typedoc should finish generating documentation successfully.
Actual Behavior
Typedoc throws an Error, preventing documentation from being generated and causing CI builds to fail.
Steps to reproduce the bug
typedoc
config:Environment
Laptop
Here's a link to the failing Travis CI Build, which runs on Node v8, v10, and v12 on Linux.
The text was updated successfully, but these errors were encountered: