I have an external library with a set of classes.
I want somehow decorate these classes in my module and make them injectable.
Right now I do next:
import * as libClasses from 'externalLib'
import {injectable} from 'inversify';
Object.keys(libClasses).forEach((field)=> {
const libClass = libClasses[field];
const decorator = injectable();
libClasses[field] = Reflect.decorate([decorator], libClass);
});
But it doesn't work.
So, the question is - how I can bind decorator programmatically?
use decorate, also from inversify.
import { decorate, injectable } from 'inversify'
decorate(injectable(), SomeClass)
@rmvermeulen Thank you!
How do you inject the library when it's decorated?
Most helpful comment
use
decorate, also from inversify.