@@ -7433,7 +7433,7 @@ namespace ts {
7433
7433
skippedPrivateMembers.set(rightProp.name, true);
7434
7434
}
7435
7435
else if (!isClassMethod(rightProp) && !isSetterWithoutGetter) {
7436
- members.set(rightProp.name, rightProp);
7436
+ members.set(rightProp.name, getNonReadonlySymbol( rightProp) );
7437
7437
}
7438
7438
}
7439
7439
for (const leftProp of getPropertiesOfType(left)) {
@@ -7449,7 +7449,7 @@ namespace ts {
7449
7449
const declarations: Declaration[] = concatenate(leftProp.declarations, rightProp.declarations);
7450
7450
const flags = SymbolFlags.Property | (leftProp.flags & SymbolFlags.Optional);
7451
7451
const result = createSymbol(flags, leftProp.name);
7452
- result.checkFlags = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp) ? CheckFlags.Readonly : 0;
7452
+ result.checkFlags = 0;
7453
7453
result.type = getUnionType([getTypeOfSymbol(leftProp), getTypeWithFacts(rightType, TypeFacts.NEUndefined)]);
7454
7454
result.leftSpread = leftProp;
7455
7455
result.rightSpread = rightProp;
@@ -7458,12 +7458,25 @@ namespace ts {
7458
7458
}
7459
7459
}
7460
7460
else {
7461
- members.set(leftProp.name, leftProp);
7461
+ members.set(leftProp.name, getNonReadonlySymbol( leftProp) );
7462
7462
}
7463
7463
}
7464
7464
return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
7465
7465
}
7466
7466
7467
+ function getNonReadonlySymbol(prop: Symbol) {
7468
+ if (!(getDeclarationModifierFlagsFromSymbol(prop) & ModifierFlags.Readonly)) {
7469
+ return prop;
7470
+ }
7471
+ const declarations: Declaration[] = prop.declarations;
7472
+ const flags = SymbolFlags.Property | (prop.flags & SymbolFlags.Optional);
7473
+ const result = createSymbol(flags, prop.name);
7474
+ result.checkFlags = 0;
7475
+ result.type = getTypeOfSymbol(prop);
7476
+ result.declarations = declarations;
7477
+ return result;
7478
+ }
7479
+
7467
7480
function isClassMethod(prop: Symbol) {
7468
7481
return prop.flags & SymbolFlags.Method && find(prop.declarations, decl => isClassLike(decl.parent));
7469
7482
}
0 commit comments