Skip to content

Commit 0ffc856

Browse files
committed
Fix crash when converting class-properties
1 parent 6a0ad48 commit 0ffc856

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
### Bug Fixes
88

99
- If file exports a symbol both under it's real name and as `default`, the `default` export will now always be the renamed symbol, #1795.
10+
- TypeDoc will no longer crash if a symbol is defined both as a normal class (and optional interface) and as a property, as is used for global Node types in older `@types/node` versions, Gerrit0/typedoc-plugin-missing-exports#5.
1011

1112
## v0.22.9 (2021-11-14)
1213

src/lib/converter/symbols.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,15 @@ export function convertSymbol(
156156
flags = removeFlag(flags, ts.SymbolFlags.ValueModule);
157157
}
158158

159-
if (hasAllFlags(symbol.flags, ts.SymbolFlags.Method)) {
159+
if (
160+
hasAnyFlag(
161+
symbol.flags,
162+
ts.SymbolFlags.Method |
163+
ts.SymbolFlags.Interface |
164+
ts.SymbolFlags.Class |
165+
ts.SymbolFlags.Variable
166+
)
167+
) {
160168
// This happens when someone declares an object with methods:
161169
// { methodProperty() {} }
162170
flags = removeFlag(flags, ts.SymbolFlags.Property);
@@ -1002,7 +1010,10 @@ function convertAccessor(
10021010

10031011
function isInherited(context: Context, symbol: ts.Symbol) {
10041012
const parentSymbol = context.project.getSymbolFromReflection(context.scope);
1005-
assert(parentSymbol);
1013+
assert(
1014+
parentSymbol,
1015+
`No parent symbol found for ${symbol.name} in ${context.scope.name}`
1016+
);
10061017
return (
10071018
parentSymbol
10081019
.getDeclarations()

0 commit comments

Comments
 (0)