@@ -3579,20 +3579,15 @@ namespace ts {
3579
3579
const type = parseFunctionOrConstructorType ( ) ;
3580
3580
let diagnostic : DiagnosticMessage ;
3581
3581
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 ;
3588
3585
}
3589
3586
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
+
3596
3591
}
3597
3592
parseErrorAtRange ( type , diagnostic ) ;
3598
3593
return type ;
@@ -3607,9 +3602,8 @@ namespace ts {
3607
3602
) : TypeNode {
3608
3603
const pos = getNodePos ( ) ;
3609
3604
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 ( ) ;
3613
3607
if ( token ( ) === operator || hasLeadingOperator ) {
3614
3608
const types = [ type ] ;
3615
3609
while ( parseOptional ( operator ) ) {
0 commit comments