In the below type script code , irrespective of whether name is \"public\" or \"private\" , java script code that is generated is same.
So my question is, how to decide
java script code that is generated is same
They produce the same JavaScript but don't have the same semantics as far as the type is concerned.
The private
member can only be accessed from inside the class whereas public
can be excessed externally.
The differences are covered here : https://basarat.gitbooks.io/typescript/content/docs/classes.html#access-modifiers
let foo = 123;
will generate the same ES5 as
const foo = 123;
However in the first case let foo = 123;foo = 456
will compile fine but const foo = 123; foo = 456
will result in a compile time error.