@@ -438,8 +438,10 @@ namespace ts {
438
438
visitNode ( cbNode , ( < JSDocTypedefTag > node ) . typeExpression ) ;
439
439
}
440
440
case SyntaxKind . JSDocTypeLiteral :
441
- for ( const tag of ( node as JSDocTypeLiteral ) . jsDocPropertyTags ) {
442
- visitNode ( cbNode , tag ) ;
441
+ if ( ( node as JSDocTypeLiteral ) . jsDocPropertyTags ) {
442
+ for ( const tag of ( node as JSDocTypeLiteral ) . jsDocPropertyTags ) {
443
+ visitNode ( cbNode , tag ) ;
444
+ }
443
445
}
444
446
return ;
445
447
case SyntaxKind . PartiallyEmittedExpression :
@@ -6672,19 +6674,18 @@ namespace ts {
6672
6674
if ( ! typeExpression || isObjectOrObjectArrayTypeReference ( typeExpression . type ) ) {
6673
6675
let child : JSDocTypeTag | JSDocPropertyTag | false ;
6674
6676
let jsdocTypeLiteral : JSDocTypeLiteral ;
6675
- let alreadyHasTypeTag = false ;
6677
+ let childTypeTag : JSDocTypeTag ;
6676
6678
const start = scanner . getStartPos ( ) ;
6677
6679
while ( child = tryParse ( ( ) => parseChildParameterOrPropertyTag ( PropertyLikeParse . Property ) ) ) {
6678
6680
if ( ! jsdocTypeLiteral ) {
6679
6681
jsdocTypeLiteral = < JSDocTypeLiteral > createNode ( SyntaxKind . JSDocTypeLiteral , start ) ;
6680
6682
}
6681
6683
if ( child . kind === SyntaxKind . JSDocTypeTag ) {
6682
- if ( alreadyHasTypeTag ) {
6684
+ if ( childTypeTag ) {
6683
6685
break ;
6684
6686
}
6685
6687
else {
6686
- jsdocTypeLiteral . jsDocTypeTag = child ;
6687
- alreadyHasTypeTag = true ;
6688
+ childTypeTag = child ;
6688
6689
}
6689
6690
}
6690
6691
else {
@@ -6698,7 +6699,8 @@ namespace ts {
6698
6699
if ( typeExpression && typeExpression . type . kind === SyntaxKind . ArrayType ) {
6699
6700
jsdocTypeLiteral . isArrayType = true ;
6700
6701
}
6701
- typedefTag . typeExpression = finishNode ( jsdocTypeLiteral ) ;
6702
+ const useChildTypeTagAsType = childTypeTag && ! isObjectOrObjectArrayTypeReference ( childTypeTag . typeExpression . type ) ;
6703
+ typedefTag . typeExpression = useChildTypeTagAsType ? childTypeTag . typeExpression : finishNode ( jsdocTypeLiteral ) ;
6702
6704
}
6703
6705
}
6704
6706
0 commit comments