@@ -3575,7 +3575,7 @@ namespace ts {
35753575 // the function type and constructor type shorthand notation
35763576 // are not allowed directly in unions and intersections, but we'll
35773577 // try to parse them gracefully and issue a helpful message.
3578- if ( isStartOfFunctionType ( ) || token ( ) === SyntaxKind . NewKeyword ) {
3578+ if ( isStartOfFunctionTypeOrConstructorType ( ) ) {
35793579 const type = parseFunctionOrConstructorType ( ) ;
35803580 let diagnostic : DiagnosticMessage ;
35813581 if ( isFunctionTypeNode ( type ) ) {
@@ -3622,11 +3622,14 @@ namespace ts {
36223622 return parseUnionOrIntersectionType ( SyntaxKind . BarToken , parseIntersectionTypeOrHigher , factory . createUnionTypeNode ) ;
36233623 }
36243624
3625- function isStartOfFunctionType ( ) : boolean {
3625+ function isStartOfFunctionTypeOrConstructorType ( ) : boolean {
36263626 if ( token ( ) === SyntaxKind . LessThanToken ) {
36273627 return true ;
36283628 }
3629- return token ( ) === SyntaxKind . OpenParenToken && lookAhead ( isUnambiguouslyStartOfFunctionType ) ;
3629+ if ( token ( ) === SyntaxKind . OpenParenToken && lookAhead ( isUnambiguouslyStartOfFunctionType ) ) {
3630+ return true ;
3631+ }
3632+ return token ( ) === SyntaxKind . NewKeyword ;
36303633 }
36313634
36323635 function skipParameterStart ( ) : boolean {
@@ -3711,7 +3714,7 @@ namespace ts {
37113714 }
37123715
37133716 function parseTypeWorker ( noConditionalTypes ?: boolean ) : TypeNode {
3714- if ( isStartOfFunctionType ( ) || token ( ) === SyntaxKind . NewKeyword ) {
3717+ if ( isStartOfFunctionTypeOrConstructorType ( ) ) {
37153718 return parseFunctionOrConstructorType ( ) ;
37163719 }
37173720 const pos = getNodePos ( ) ;
0 commit comments