If I do something like this below, how can I access the property out the class?
class Person
{
private static name: string;
}
console.log(Person.name);
Shouldn’t it inaccessible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It should be an error but isn’t. From the spec, section 8.2.1:
Accessibility modifiers on statics are something the team has considered in the past. If you have a strong use case you should bring this up on codeplex site!