typedoc 0.25.5 → 0.25.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -64,7 +64,7 @@ function loadConverters() {
|
|
|
64
64
|
exports.loadConverters = loadConverters;
|
|
65
65
|
// This ought not be necessary, but we need some way to discover recursively
|
|
66
66
|
// typed symbols which do not have type nodes. See the `recursive` symbol in the variables test.
|
|
67
|
-
const
|
|
67
|
+
const seenTypes = new Set();
|
|
68
68
|
function maybeConvertType(context, typeOrNode) {
|
|
69
69
|
if (!typeOrNode) {
|
|
70
70
|
return;
|
|
@@ -86,24 +86,20 @@ function convertType(context, typeOrNode) {
|
|
|
86
86
|
// TS 4.2 added this to enable better tracking of type aliases.
|
|
87
87
|
// We need to check it here, not just in the union checker, because typeToTypeNode
|
|
88
88
|
// will use the origin when serializing
|
|
89
|
+
// aliasSymbol check is important - #2468
|
|
89
90
|
if (typeOrNode.isUnion() &&
|
|
90
91
|
typeOrNode.origin &&
|
|
91
|
-
!typeOrNode.origin.isUnion()
|
|
92
|
+
!typeOrNode.origin.isUnion() &&
|
|
93
|
+
!typeOrNode.aliasSymbol) {
|
|
92
94
|
return convertType(context, typeOrNode.origin);
|
|
93
95
|
}
|
|
94
96
|
// IgnoreErrors is important, without it, we can't assert that we will get a node.
|
|
95
97
|
const node = context.checker.typeToTypeNode(typeOrNode, void 0, typescript_1.default.NodeBuilderFlags.IgnoreErrors);
|
|
96
98
|
(0, assert_1.default)(node); // According to the TS source of typeToString, this is a bug if it does not hold.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
seenTypeSymbols.has(symbol)) {
|
|
102
|
-
const typeString = context.checker.typeToString(typeOrNode);
|
|
103
|
-
context.logger.verbose(`Refusing to recurse when converting type: ${typeString}`);
|
|
104
|
-
return new models_1.UnknownType(typeString);
|
|
105
|
-
}
|
|
106
|
-
seenTypeSymbols.add(symbol);
|
|
99
|
+
if (seenTypes.has(typeOrNode.id)) {
|
|
100
|
+
const typeString = context.checker.typeToString(typeOrNode);
|
|
101
|
+
context.logger.verbose(`Refusing to recurse when converting type: ${typeString}`);
|
|
102
|
+
return new models_1.UnknownType(typeString);
|
|
107
103
|
}
|
|
108
104
|
let converter = converters.get(node.kind);
|
|
109
105
|
if (converter) {
|
|
@@ -112,9 +108,9 @@ function convertType(context, typeOrNode) {
|
|
|
112
108
|
!typeOrNode.isIntersection()) {
|
|
113
109
|
converter = typeLiteralConverter;
|
|
114
110
|
}
|
|
111
|
+
seenTypes.add(typeOrNode.id);
|
|
115
112
|
const result = converter.convertType(context, typeOrNode, node);
|
|
116
|
-
|
|
117
|
-
seenTypeSymbols.delete(symbol);
|
|
113
|
+
seenTypes.delete(typeOrNode.id);
|
|
118
114
|
return result;
|
|
119
115
|
}
|
|
120
116
|
return requestBugReport(context, typeOrNode);
|
|
@@ -30,7 +30,6 @@ export declare class TypeDocReader implements OptionsReader {
|
|
|
30
30
|
*
|
|
31
31
|
* @param path Path to the typedoc.(js|json) file. If path is a directory
|
|
32
32
|
* typedoc file will be attempted to be found at the root of this path
|
|
33
|
-
* @param logger
|
|
34
33
|
* @return the typedoc.(js|json) file path or undefined
|
|
35
34
|
*/
|
|
36
35
|
private findTypedocFile;
|
|
@@ -149,7 +149,6 @@ class TypeDocReader {
|
|
|
149
149
|
*
|
|
150
150
|
* @param path Path to the typedoc.(js|json) file. If path is a directory
|
|
151
151
|
* typedoc file will be attempted to be found at the root of this path
|
|
152
|
-
* @param logger
|
|
153
152
|
* @return the typedoc.(js|json) file path or undefined
|
|
154
153
|
*/
|
|
155
154
|
findTypedocFile(path) {
|