function classDecorator() { return function <T extends {new(...args:any[]):{}}> (constructor:T) { return class extends constructor { newProperty = "new property"; hello = "override"; } } } @classDecorator() class Test { property = "property"; hello: string; constructor(m: string) { this.hello = m; } } let t = new Test("world") console.log(t) Test { property: 'property', hello: 'override', newProperty: 'new property' }
<T extends {new(...args:any[]):{}}> - You are basically saying that your class need a constructor in its definition through this (new...)
Seonglae Cho