TypeScript Version: 3.1.0-dev.20180914
Code
class C {
constructor(readonly x: number, private readonly y: number) {}
}
const a = { ...(new C(0, 1)) };
const b = { x: "", y: "", ...a };
b.x.toUpperCase(); // Error (good)
b.y.toUpperCase(); // No error (bad)
Expected behavior:
Error at the spread since that accesses a private property.
At least there should be an error at b.y since that accesses the same private property, and is a number at runtime.
Actual behavior:
No error except at b.x.toUpperCase() which is correctly an error.
TypeScript Version: 3.1.0-dev.20180914
Code
Expected behavior:
Error at the spread since that accesses a private property.
At least there should be an error at
b.ysince that accesses the same private property, and is anumberat runtime.Actual behavior:
No error except at
b.x.toUpperCase()which is correctly an error.