Skip to content

Commit e4c84fc

Browse files
committed
hoist isUnionType
1 parent 98b9d82 commit e4c84fc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/compiler/parser.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -3601,13 +3601,14 @@ namespace ts {
36013601
createTypeNode: (types: NodeArray<TypeNode>) => UnionOrIntersectionTypeNode
36023602
): TypeNode {
36033603
const pos = getNodePos();
3604+
const isUnionType = operator === SyntaxKind.BarToken;
36043605
const hasLeadingOperator = parseOptional(operator);
3605-
let type = hasLeadingOperator && parseFunctionOrConstructorTypeToError(operator === SyntaxKind.BarToken)
3606+
let type = hasLeadingOperator && parseFunctionOrConstructorTypeToError(isUnionType)
36063607
|| parseConstituentType();
36073608
if (token() === operator || hasLeadingOperator) {
36083609
const types = [type];
36093610
while (parseOptional(operator)) {
3610-
types.push(parseFunctionOrConstructorTypeToError(operator === SyntaxKind.BarToken) || parseConstituentType());
3611+
types.push(parseFunctionOrConstructorTypeToError(isUnionType) || parseConstituentType());
36113612
}
36123613
type = finishNode(createTypeNode(createNodeArray(types, pos)), pos);
36133614
}

0 commit comments

Comments
 (0)