-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed as not planned
Labels
BugA bug in TypeScriptA bug in TypeScript
Milestone
Description
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.
filev-svt
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript