TypeScript - 属性装饰器

优质
小牛编辑
142浏览
2023-12-01
  1. Object.defineProperty(target, key, { writable: false });
  2. }
  3. @ReadOnly // notice there are no `()`
  4. name: string;
  5. const t = new Test();
  6. t.name = 'jan';