I'm using TypeScript in my project and I have come across an issue. I'm defining an interface like this:
interface IModuleMenuItem {
name: string;
}
I want to create a class that implements from this interface but I want the name to be a private property like this:
class ModuleMenuItem implements IModuleMenuItem {
private name: string;
}
I'm getting the following error:
Class ModuleMenuItem incorrectly implements interface IModuleMenuItem. Property name is private in type ModuleMenuItem but not in type IModuleMenuItem.
How can I define a property as private or protected when implementing an interface?