Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. function classDecorator<T extends { new (...args:any[]): object }>(constructor:T) {
  2. return class extends constructor {
  3. newProperty = "new property";
  4. hello = "override";
  5. }
  6. }
  7.  
  8. @classDecorator
  9. class Greeter {
  10. property = "property";
  11. hello: string;
  12. constructor(m: string) {
  13. this.hello = m;
  14. }
  15. }
  16.  
  17. console.log(new Greeter("world"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement