diff --git a/src/lib/converter/context.ts b/src/lib/converter/context.ts index 452df4e0f..82b4baf1b 100644 --- a/src/lib/converter/context.ts +++ b/src/lib/converter/context.ts @@ -13,6 +13,7 @@ import { import type { Converter } from "./converter"; import { isNamedNode } from "./utils/nodes"; import { ConverterEvents } from "./converter-events"; +import { resolveAliasedSymbol } from "./utils/symbols"; /** * The context describes the current state the converter is in. @@ -161,13 +162,8 @@ export class Context { return symbol; } - resolveAliasedSymbol(symbol: ts.Symbol): ts.Symbol; - resolveAliasedSymbol(symbol: ts.Symbol | undefined): ts.Symbol | undefined; - resolveAliasedSymbol(symbol: ts.Symbol | undefined) { - while (symbol && ts.SymbolFlags.Alias & symbol.flags) { - symbol = this.checker.getAliasedSymbol(symbol); - } - return symbol; + resolveAliasedSymbol(symbol: ts.Symbol): ts.Symbol { + return resolveAliasedSymbol(symbol, this.checker); } createDeclarationReflection( diff --git a/src/lib/converter/converter.ts b/src/lib/converter/converter.ts index 75159f1f8..ccefb04cc 100644 --- a/src/lib/converter/converter.ts +++ b/src/lib/converter/converter.ts @@ -17,6 +17,7 @@ import { getCommonDirectory } from "../utils/fs"; import { createMinimatch } from "../utils/paths"; import { IMinimatch } from "minimatch"; import { hasFlag } from "../utils/enum"; +import { resolveAliasedSymbol } from "./utils/symbols"; /** * Compiles source files using TypeScript and converts compiler symbols to reflections. @@ -360,7 +361,9 @@ export class Converter extends ChildableComponent< this.excludeNotDocumented && // If the enum is included, we should include members even if not documented. !hasFlag(symbol.flags, ts.SymbolFlags.EnumMember) && - symbol.getDocumentationComment(checker).length === 0 + resolveAliasedSymbol(symbol, checker).getDocumentationComment( + checker + ).length === 0 ) { return true; } diff --git a/src/lib/converter/utils/symbols.ts b/src/lib/converter/utils/symbols.ts new file mode 100644 index 000000000..fa84d1a60 --- /dev/null +++ b/src/lib/converter/utils/symbols.ts @@ -0,0 +1,11 @@ +import * as ts from "typescript"; + +export function resolveAliasedSymbol( + symbol: ts.Symbol, + checker: ts.TypeChecker +): ts.Symbol { + while (ts.SymbolFlags.Alias & symbol.flags) { + symbol = checker.getAliasedSymbol(symbol); + } + return symbol; +} diff --git a/src/test/converter/variables/specs.nodoc.json b/src/test/converter/variables/specs.nodoc.json index 1b0391fce..90695da35 100644 --- a/src/test/converter/variables/specs.nodoc.json +++ b/src/test/converter/variables/specs.nodoc.json @@ -355,6 +355,29 @@ "kindString": "Module", "flags": {}, "children": [ + { + "id": 22, + "name": "objectLiteral", + "kind": 32, + "kindString": "Variable", + "flags": { + "isConst": true + }, + "comment": { + "shortText": "An object literal." + }, + "type": { + "type": "reflection", + "declaration": { + "id": 23, + "name": "__type", + "kind": 65536, + "kindString": "Type literal", + "flags": {} + } + }, + "defaultValue": "..." + }, { "id": 20, "name": "typeLiteral", @@ -383,13 +406,14 @@ "title": "Variables", "kind": 32, "children": [ + 22, 20 ] } ] }, { - "id": 22, + "id": 24, "name": "variable", "kind": 1, "kindString": "Module", @@ -404,7 +428,7 @@ 1, 15, 19, - 22 + 24 ] } ]