Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function classDecorator<T extends { new (...args:any[]): object }>(constructor:T) {
- return class extends constructor {
- newProperty = "new property";
- hello = "override";
- }
- }
- @classDecorator
- class Greeter {
- property = "property";
- hello: string;
- constructor(m: string) {
- this.hello = m;
- }
- }
- console.log(new Greeter("world"));
Advertisement
Add Comment
Please, Sign In to add comment