Is there an equivalent to “sealed” or “final” in TypeScript?

后端 未结 3 459
慢半拍i
慢半拍i 2021-01-07 16:38

I\'m trying to implement a method in a super class that should be available for use, but not changeable, in sub classes. Consider this:

export abstract clas         


        
3条回答
  •  一向
    一向 (楼主)
    2021-01-07 17:15

    No, at the time of this writing there is not. There is a proposal for such a keyword which is still being considered, but may or may not ever be implemented.

    See:

    • github.com/Microsoft/TypeScript/issues/9264, and
    • github.com/Microsoft/TypeScript/issues/8306

提交回复
热议问题