How to define a private property when implementing an interface in Typescript?

前端 未结 5 1081
陌清茗
陌清茗 2021-02-03 17:05

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;
}
         


        
5条回答
  •  春和景丽
    2021-02-03 17:45

    The only way you can have an inner state and assign interface to that instead of class and make that state private

    class A{
      private state:IA = ...
    }
    

提交回复
热议问题