Closed
Description
Consider:
class Apple {
private size: number;
constructor(size: number) {
this.size = size;
}
get Size(): number {
return this.size;
}
}
let a: Apple = new Apple(4);
console.log(a.Size);
a.Size = 5; // should this should throw a compile time error?
It strikes me that the attempted assignment to a.Size
should produce a compile time error.
Instead we learn about it at runtime (target es6
with v1.6.0-dev.20150806
)
[Error: Cannot set property Size of #<Apple> which has only a getter]
Thoughts?
Metadata
Metadata
Assignees
Labels
No labels