I have interface:
export interface IFieldValue {
name: string;
value: string;
}
And I have a class that implements it:
class Person implements IFieldValue{
name: string;
value: string;
constructor (name: string, value: string) {
this.name = name;
this.value = value;
}
}
after reading this post I've thinking about refactoring:
class Person implements IFieldValue{
constructor(public name: string, public value: string) {
}
}
Question : In first class I have fields which by default should be as private. In second sample I can only set them as public. Is it all correct in my understanding of default Access modifiers in TypeScript?