How to pass an instance variable into typescript decorator arguments?

后端 未结 2 832
一向
一向 2020-12-06 05:08

How to implement a typescript decorator? is a good example about how to use decorator in typescript.

Considering the below case,

class MyClass {
             


        
2条回答
  •  天命终不由人
    2020-12-06 05:41

    You can't access to a object property from a attribute definition.

    Decorator is called when the property is defined.

    You could use getter or setter to get control when access to the property.

提交回复
热议问题