File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -18435,11 +18435,13 @@ namespace ts {
18435
18435
}
18436
18436
return contextSensitive === true ? getTypeOfExpression(left) : contextSensitive;
18437
18437
case SyntaxKind.BarBarToken:
18438
- // When an || expression has a contextual type, the operands are contextually typed by that type. When an ||
18439
- // expression has no contextual type, the right operand is contextually typed by the type of the left operand,
18440
- // except for the special case of Javascript declarations of the form `namespace.prop = namespace.prop || {}`
18438
+ // When an || expression has a contextual type, the operands are contextually typed by that type, except
18439
+ // when that type originates in a binding pattern, the right operand is contextually typed by the type of
18440
+ // the left operand. When an || expression has no contextual type, the right operand is contextually typed
18441
+ // by the type of the left operand, except for the special case of Javascript declarations of the form
18442
+ // `namespace.prop = namespace.prop || {}`.
18441
18443
const type = getContextualType(binaryExpression, contextFlags);
18442
- return !type && node === right && ! isDefaultedExpandoInitializer(binaryExpression) ?
18444
+ return node === right && (type && type.pattern || !type && ! isDefaultedExpandoInitializer(binaryExpression) ) ?
18443
18445
getTypeOfExpression(left) : type;
18444
18446
case SyntaxKind.AmpersandAmpersandToken:
18445
18447
case SyntaxKind.CommaToken:
You can’t perform that action at this time.
0 commit comments