Skip to main content

Announcing 7.6.1

· 2 min read
Roberto Pintos López
InversifyJS maintainer

We're excited to announce InversifyJS 7.6.1! This release brings enhanced container hierarchy features and improved decorator capabilities.

Chained Resolution Mode

One of the most significant additions in this release is chained resolution mode for container hierarchies. Previously, when resolving multiple services with getAll(), InversifyJS would only look in the first container that had bindings for that service identifier.

Now, with the chained: true option, you can collect bindings from all levels of the container hierarchy:

const parentContainer: Container = new Container();

const container: Container = new Container({
parent: parentContainer,
});

parentContainer.bind<Weapon>('Weapon').to(Katana);
container.bind<Weapon>('Weapon').to(Shuriken);

// returns Weapon[] with both Katana and Shuriken instances
const weapons: Weapon[] = container.getAll<Weapon>('Weapon', { chained: true });

Enhanced @multiInject Decorator

The @multiInject decorator now supports chained resolution, allowing you to inject services from all levels of the container hierarchy. This is particularly useful in plugin architectures or modular applications:

class PluginManager {
constructor(
@multiInject('Plugin', { chained: true })
private plugins: Plugin[]
) {
// This will include plugins from both parent and child containers
}
}

This enhancement makes it easy to collect implementations from different container levels without manually calling getAll() with chained options.

API Consistency Improvements

We've updated the Container API to use GetAllOptions for getAll() and getAllAsync() methods, providing better consistency and access to advanced features like chained resolution.

The binding syntax has also been refined with more consistent parameter naming across constraint methods.