@@ -3579,20 +3579,15 @@ namespace ts {
35793579 const type = parseFunctionOrConstructorType ( ) ;
35803580 let diagnostic : DiagnosticMessage ;
35813581 if ( isFunctionTypeNode ( type ) ) {
3582- if ( isInUnionType ) {
3583- diagnostic = Diagnostics . Function_type_notation_must_be_parenthesized_when_used_in_a_union_type ;
3584- }
3585- else {
3586- diagnostic = Diagnostics . Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type ;
3587- }
3582+ diagnostic = isInUnionType
3583+ ? Diagnostics . Function_type_notation_must_be_parenthesized_when_used_in_a_union_type ;
3584+ : Diagnostics . Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type ;
35883585 }
35893586 else {
3590- if ( isInUnionType ) {
3591- diagnostic = Diagnostics . Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type ;
3592- }
3593- else {
3594- diagnostic = Diagnostics . Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type ;
3595- }
3587+ diagnostic = isInUnionType ?
3588+ ? Diagnostics . Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type
3589+ : Diagnostics . Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type ;
3590+
35963591 }
35973592 parseErrorAtRange ( type , diagnostic ) ;
35983593 return type ;
@@ -3607,9 +3602,8 @@ namespace ts {
36073602 ) : TypeNode {
36083603 const pos = getNodePos ( ) ;
36093604 const hasLeadingOperator = parseOptional ( operator ) ;
3610- let type = hasLeadingOperator ?
3611- parseFunctionOrConstructorTypeToError ( operator === SyntaxKind . BarToken ) || parseConstituentType ( ) :
3612- parseConstituentType ( ) ;
3605+ let type = hasLeadingOperator && parseFunctionOrConstructorTypeToError ( operator === SyntaxKind . BarToken )
3606+ || parseConstituentType ( ) ;
36133607 if ( token ( ) === operator || hasLeadingOperator ) {
36143608 const types = [ type ] ;
36153609 while ( parseOptional ( operator ) ) {
0 commit comments