@@ -22,6 +22,7 @@ import {
22
22
UnknownType ,
23
23
MappedType ,
24
24
SignatureReflection ,
25
+ ReflectionFlag ,
25
26
} from "../models" ;
26
27
import { OptionalType } from "../models/types/optional" ;
27
28
import { RestType } from "../models/types/rest" ;
@@ -103,7 +104,7 @@ const seenTypeSymbols = new Set<ts.Symbol>();
103
104
export function convertType (
104
105
context : Context ,
105
106
typeOrNode : ts . Type | ts . TypeNode | undefined
106
- ) {
107
+ ) : Type {
107
108
if ( ! typeOrNode ) {
108
109
return new IntrinsicType ( "any" ) ;
109
110
}
@@ -117,6 +118,11 @@ export function convertType(
117
118
return requestBugReport ( context , typeOrNode ) ;
118
119
}
119
120
121
+ // TS 4.2 added this to enable better tracking of type aliases.
122
+ if ( typeOrNode . isUnion ( ) && typeOrNode . origin ) {
123
+ return convertType ( context , typeOrNode . origin ) ;
124
+ }
125
+
120
126
// IgnoreErrors is important, without it, we can't assert that we will get a node.
121
127
const node = context . checker . typeToTypeNode (
122
128
typeOrNode ,
@@ -213,6 +219,16 @@ const constructorConverter: TypeConverter<ts.ConstructorTypeNode, ts.Type> = {
213
219
ReflectionKind . ConstructorSignature ,
214
220
reflection
215
221
) ;
222
+ // This is unfortunate... but seems the obvious place to put this with the current
223
+ // architecture. Ideally, this would be a property on a "ConstructorType"... but that
224
+ // needs to wait until TypeDoc 0.22 when making other breaking changes.
225
+ if (
226
+ node . modifiers ?. some (
227
+ ( m ) => m . kind === ts . SyntaxKind . AbstractKeyword
228
+ )
229
+ ) {
230
+ signature . setFlag ( ReflectionFlag . Abstract ) ;
231
+ }
216
232
context . registerReflection ( signature , void 0 ) ;
217
233
const signatureCtx = rc . withScope ( signature ) ;
218
234
0 commit comments