Closed
Description
TypeScript Version:
$ tsc -v
Version 1.8.10
Create file app.ts with following content:
class User {
constructor(private name:string) {
}
public hello(who:User) {
// name is the private property of object 'who'. TS should show error like
// "Cat access private field 'name'"
console.log("Hello, " + who.name);
}
}
var vasya = new User("VASYA");
var peter = new User("PETER");
vasya.hello(peter);
Compile this file
tsc app.ts
Actual behavior:
You will see no error.
Expected behavior:
It should show error
"Cat access private field 'name'"