(isInUnionType)
| 34142 | return allowConditionalTypesAnd(parsePostfixTypeOrHigher); |
| 34143 | } |
| 34144 | function parseFunctionOrConstructorTypeToError(isInUnionType) { |
| 34145 | // the function type and constructor type shorthand notation |
| 34146 | // are not allowed directly in unions and intersections, but we'll |
| 34147 | // try to parse them gracefully and issue a helpful message. |
| 34148 | if (isStartOfFunctionTypeOrConstructorType()) { |
| 34149 | var type = parseFunctionOrConstructorType(); |
| 34150 | var diagnostic = void 0; |
| 34151 | if (ts.isFunctionTypeNode(type)) { |
| 34152 | diagnostic = isInUnionType |
| 34153 | ? ts.Diagnostics.Function_type_notation_must_be_parenthesized_when_used_in_a_union_type |
| 34154 | : ts.Diagnostics.Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type; |
| 34155 | } |
| 34156 | else { |
| 34157 | diagnostic = isInUnionType |
| 34158 | ? ts.Diagnostics.Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type |
| 34159 | : ts.Diagnostics.Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type; |
| 34160 | } |
| 34161 | parseErrorAtRange(type, diagnostic); |
| 34162 | return type; |
| 34163 | } |
| 34164 | return undefined; |
| 34165 | } |
| 34166 | function parseUnionOrIntersectionType(operator, parseConstituentType, createTypeNode) { |
| 34167 | var pos = getNodePos(); |
| 34168 | var isUnionType = operator === 51 /* SyntaxKind.BarToken */; |
no test coverage detected
searching dependent graphs…