@@ -147,12 +147,12 @@ module.exports = function typeConverter(src, filename = 'test.ts') {
147
147
if ( jsDocNode ) {
148
148
let comment = src . substring ( jsDocNode . pos , jsDocNode . end )
149
149
const name = getName ( statement , src )
150
-
150
+
151
151
if ( ts . isTypeAliasDeclaration ( statement ) ) {
152
152
if ( ts . isFunctionTypeNode ( statement . type ) ) {
153
153
comment = appendComment ( comment , `@typedef {function} ${ name } ` )
154
154
return convertParams ( comment , statement , src )
155
- }
155
+ }
156
156
if ( ts . isTypeLiteralNode ( statement . type ) ) {
157
157
comment = appendComment ( comment , `@typedef {object} ${ name } ` )
158
158
return convertMembers ( comment , statement . type , src )
@@ -161,6 +161,11 @@ module.exports = function typeConverter(src, filename = 'test.ts') {
161
161
comment = appendComment ( comment , `@typedef {object} ${ name } ` )
162
162
return convertMembers ( comment , statement . type , src )
163
163
}
164
+ if ( ts . isUnionTypeNode ( statement . type ) || ts . isSimpleInlineableExpression ( statement . type ) ) {
165
+ let typeName = getTypeName ( statement . type , src )
166
+ comment = appendComment ( comment , `@typedef {${ typeName } } ${ name } ` )
167
+ return convertMembers ( comment , statement . type , src )
168
+ }
164
169
}
165
170
if ( ts . isInterfaceDeclaration ( statement ) ) {
166
171
comment = appendComment ( comment , `@interface ${ name } ` )
0 commit comments