Skip to content

Commit 81779eb

Browse files
kevineatonblakeembrey
authored andcommitted
Check if the decorators are undefined in the export (#562)
1 parent 6edcbd5 commit 81779eb

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

src/lib/converter/nodes/export.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,25 @@ export class ExportConverter extends ConverterNodeComponent<ts.ExportAssignment>
2525
}
2626
if (symbol) {
2727
const project = context.project;
28-
symbol.declarations.forEach((declaration) => {
29-
if (!declaration.symbol) {
30-
return;
31-
}
32-
const id = project.symbolMapping[context.getSymbolID(declaration.symbol)];
33-
if (!id) {
34-
return;
35-
}
36-
37-
const reflection = project.reflections[id];
38-
if (node.isExportEquals && reflection instanceof DeclarationReflection) {
39-
(<DeclarationReflection> reflection).setFlag(ReflectionFlag.ExportAssignment, true);
40-
}
41-
markAsExported(reflection);
42-
});
28+
// if the symbol declarations are undefined due to an export, we skip it
29+
// fixes https://github.com/TypeStrong/typedoc/issues/513
30+
if (symbol.declarations) {
31+
symbol.declarations.forEach((declaration) => {
32+
if (!declaration.symbol) {
33+
return;
34+
}
35+
const id = project.symbolMapping[context.getSymbolID(declaration.symbol)];
36+
if (!id) {
37+
return;
38+
}
39+
40+
const reflection = project.reflections[id];
41+
if (node.isExportEquals && reflection instanceof DeclarationReflection) {
42+
(<DeclarationReflection> reflection).setFlag(ReflectionFlag.ExportAssignment, true);
43+
}
44+
markAsExported(reflection);
45+
});
46+
}
4347
}
4448

4549
function markAsExported(reflection: Reflection) {

src/test/renderer/specs/classes/_default_export_.defaultexportedclass.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ <h1>Class DefaultExportedClass</h1>
7474
<div class="lead">
7575
<p>This class is exported via es6 export syntax.</p>
7676
</div>
77-
<pre><code><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">DefaultExportedClass</span></span>
77+
<pre><code><span class="hljs-builtin-name">export</span><span class="hljs-built_in"> default </span>class DefaultExportedClass
7878
</code></pre>
7979
</div>
8080
</section>

0 commit comments

Comments
 (0)