Skip to main content
Version: 0.5.0

injectFromBase

@injectabe and @inject metadata are not propagated to child classes. @injectFromBase decorator exists for that purpose.

import { inject, injectable } from '@cuaklabs/iocuak';

import { dummyFooServiceId, dummyBarServiceId } from 'some/path';

@injectable()
class Dummy {
@inject(dummyFooServiceId)
public foo: unknown;
}

/*
* @injectFromBase() allows DummyChild to have a foo property with
* the same metadata as if decorated with @inject(dummyFooServiceId
*/

@injectable()
@injectFromBase()
class DummyChild extends Dummy {
@inject(dummyBarServiceId)
public bar: unknown;
}