Inheritance is supported for properties when both the base and the extended class is marked with the @Service() decorator. Classes which extend a class with decorated properties will receive the initialized class instances on those properties upon creation.
import'reflect-metadata';import { Container, Token, Inject, Service } from'typedi';@Service()classInjectedClass { name:string='InjectedClass';}@Service()classBaseClass { name:string='BaseClass'; @Inject() injectedClass:InjectedClass;}@Service()classExtendedClassextendsBaseClass { name:string='ExtendedClass';}constinstance=Container.get(ExtendedClass);// instance has the `name` property with "ExtendedClass" value (overwritten the base class)// and the `injectedClass` property with the instance of the `InjectedClass` classconsole.log(instance.injectedClass.name);// logs "InjectedClass"console.log(instance.name);// logs "ExtendedClass"