Closed
Description
TypeScript Version: 4.0.0-Beta
Search Terms:
- getter setter
- writeonly property
- readonly property
Code
interface ITest {
readonly name: string;
}
class Test implements ITest {
#_name: string = "";
set name(value: string) { this.#_name = value; }
}
const test = new Test();
test.name = "James";
const it = test;
console.log(it.name);
Expected behavior:
TSC can report a error since Test
does not implment get name
accessor.
ITest
declare name
property is readonly, that means name
is readable. But name
property of Test
is not readable. It's against the interface.
Actual behavior:
No Error.
Playground Link: Provided
Related Issues:
maybe related to #12, but they are different.