1. function visitDecorator(target: any, key: string, descriptor: PropertyDescriptor) {
    2. // descriptor.writable = false;
    3. }
    4. class Test {
    5. private _name: string;
    6. constructor(name: string) {
    7. this._name = name;
    8. }
    9. get name() {
    10. return this._name;
    11. }
    12. @visitDecorator
    13. set name(name: string) {
    14. this._name = name;
    15. }
    16. }
    17. const test = new Test('dell');
    18. test.name = 'dell lee';
    19. console.log(test.name);