@@ -3575,7 +3575,7 @@ namespace ts {
3575
3575
// the function type and constructor type shorthand notation
3576
3576
// are not allowed directly in unions and intersections, but we'll
3577
3577
// try to parse them gracefully and issue a helpful message.
3578
- if ( isStartOfFunctionType ( ) || token ( ) === SyntaxKind . NewKeyword ) {
3578
+ if ( isStartOfFunctionTypeOrConstructorType ( ) ) {
3579
3579
const type = parseFunctionOrConstructorType ( ) ;
3580
3580
let diagnostic : DiagnosticMessage ;
3581
3581
if ( isFunctionTypeNode ( type ) ) {
@@ -3622,11 +3622,14 @@ namespace ts {
3622
3622
return parseUnionOrIntersectionType ( SyntaxKind . BarToken , parseIntersectionTypeOrHigher , factory . createUnionTypeNode ) ;
3623
3623
}
3624
3624
3625
- function isStartOfFunctionType ( ) : boolean {
3625
+ function isStartOfFunctionTypeOrConstructorType ( ) : boolean {
3626
3626
if ( token ( ) === SyntaxKind . LessThanToken ) {
3627
3627
return true ;
3628
3628
}
3629
- return token ( ) === SyntaxKind . OpenParenToken && lookAhead ( isUnambiguouslyStartOfFunctionType ) ;
3629
+ if ( token ( ) === SyntaxKind . OpenParenToken && lookAhead ( isUnambiguouslyStartOfFunctionType ) ) {
3630
+ return true ;
3631
+ }
3632
+ return token ( ) === SyntaxKind . NewKeyword ;
3630
3633
}
3631
3634
3632
3635
function skipParameterStart ( ) : boolean {
@@ -3711,7 +3714,7 @@ namespace ts {
3711
3714
}
3712
3715
3713
3716
function parseTypeWorker ( noConditionalTypes ?: boolean ) : TypeNode {
3714
- if ( isStartOfFunctionType ( ) || token ( ) === SyntaxKind . NewKeyword ) {
3717
+ if ( isStartOfFunctionTypeOrConstructorType ( ) ) {
3715
3718
return parseFunctionOrConstructorType ( ) ;
3716
3719
}
3717
3720
const pos = getNodePos ( ) ;
0 commit comments