#Decorator-Factory override constructor

6 messages · Page 1 of 1 (latest)

limber lantern
#

Let's say we got a function decorator

export function someDecorator() {
  return (target, key) => {
    target.consturctor = () => { // do some stuff here }
  }
}

I have to use class decorator in order to override the constructor of target ?

#

Decorator-Factory override constructor

limber lantern
#

found another way of doing what i wanted (extending the class and use super to do extra stuff) but tbh there might be examples where i cant do this. Any ideas?

limber lantern
#

okay seems like its not possible

#

only the class decorator can do this.