@@ -207,6 +207,8 @@ namespace ts {
207207 visitNode ( cbNode , ( < AsExpression > node ) . type ) ;
208208 case SyntaxKind . NonNullExpression :
209209 return visitNode ( cbNode , ( < NonNullExpression > node ) . expression ) ;
210+ case SyntaxKind . NonNullTypeNode :
211+ return visitNode ( cbNode , ( < NonNullTypeNode > node ) . type ) ;
210212 case SyntaxKind . MetaProperty :
211213 return visitNode ( cbNode , ( < MetaProperty > node ) . name ) ;
212214 case SyntaxKind . ConditionalExpression :
@@ -1959,6 +1961,7 @@ namespace ts {
19591961 while ( parseOptional ( SyntaxKind . DotToken ) ) {
19601962 if ( token ( ) === SyntaxKind . LessThanToken ) {
19611963 // the entity is part of a JSDoc-style generic, so record the trailing dot for later error reporting
1964+ console . trace ( "parseEntityName:jsdocDotPos" ) ;
19621965 entity . jsdocDotPos = dotPos ;
19631966 break ;
19641967 }
@@ -2122,6 +2125,7 @@ namespace ts {
21222125 }
21232126
21242127 function parseJSDocUnknownOrNullableType ( ) : JSDocUnknownType | JSDocNullableType {
2128+ console . trace ( "parseJSDocUnknownOrNullableType" ) ;
21252129 const pos = scanner . getStartPos ( ) ;
21262130 // skip the ?
21272131 nextToken ( ) ;
@@ -2657,6 +2661,7 @@ namespace ts {
26572661 case SyntaxKind . AsteriskToken :
26582662 return parseJSDocAllType ( ) ;
26592663 case SyntaxKind . QuestionToken :
2664+ console . trace ( "parseNonArrayType:QuestionToken" ) ;
26602665 return parseJSDocUnknownOrNullableType ( ) ;
26612666 case SyntaxKind . FunctionKeyword :
26622667 return parseJSDocFunctionType ( ) ;
@@ -2794,7 +2799,31 @@ namespace ts {
27942799 case SyntaxKind . KeyOfKeyword :
27952800 return parseTypeOperator ( SyntaxKind . KeyOfKeyword ) ;
27962801 }
2797- return parseArrayTypeOrHigher ( ) ;
2802+ const type = parseArrayTypeOrHigher ( ) ;
2803+ return parsePostfixTypeOperatorOrHigher ( type ) ;
2804+ }
2805+
2806+ function parsePostfixTypeOperator ( type : TypeNode ) { // , operator: SyntaxKind.NonNullTypeNode
2807+ // const node = <TypeOperatorNode>createNode(SyntaxKind.TypeOperator);
2808+ const node = < NonNullTypeNode > createNode ( SyntaxKind . NonNullTypeNode ) ;
2809+ // parseExpected(operator);
2810+ parseExpected ( SyntaxKind . ExclamationToken ) ;
2811+ // node.operator = operator;
2812+ node . type = type ;
2813+ return finishNode ( node ) ;
2814+ }
2815+
2816+ function parsePostfixTypeOperatorOrHigher ( type : TypeNode ) : TypeNode {
2817+ let postfixed : TypeNode ;
2818+ switch ( token ( ) ) {
2819+ case SyntaxKind . NonNullTypeNode :
2820+ return parsePostfixTypeOperator ( type ) ; // , SyntaxKind.NonNullTypeNode
2821+ }
2822+ if ( postfixed ) {
2823+ return parsePostfixTypeOperatorOrHigher ( postfixed ) ;
2824+ } else {
2825+ return type ;
2826+ }
27982827 }
27992828
28002829 function parseUnionOrIntersectionType ( kind : SyntaxKind . UnionType | SyntaxKind . IntersectionType , parseConstituentType : ( ) => TypeNode , operator : SyntaxKind . BarToken | SyntaxKind . AmpersandToken ) : TypeNode {
0 commit comments