File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -8426,8 +8426,11 @@ namespace ts {
8426
8426
// Assignments only narrow the computed type if the declared type is a union type. Thus, we
8427
8427
// only need to evaluate the assigned type if the declared type is a union type.
8428
8428
if (isMatchingReference(reference, node)) {
8429
- const isIncrementOrDecrement = node.parent.kind === SyntaxKind.PrefixUnaryExpression || node.parent.kind === SyntaxKind.PostfixUnaryExpression;
8430
- return declaredType.flags & TypeFlags.Union && !isIncrementOrDecrement ?
8429
+ if (node.parent.kind === SyntaxKind.PrefixUnaryExpression || node.parent.kind === SyntaxKind.PostfixUnaryExpression) {
8430
+ const flowType = getTypeAtFlowNode(flow.antecedent);
8431
+ return createFlowType(getBaseTypeOfLiteralType(getTypeFromFlowType(flowType)), isIncomplete(flowType));
8432
+ }
8433
+ return declaredType.flags & TypeFlags.Union ?
8431
8434
getAssignmentReducedType(<UnionType>declaredType, getInitialOrAssignedType(node)) :
8432
8435
declaredType;
8433
8436
}
You can’t perform that action at this time.
0 commit comments