InversifyJS
InversifyJS copied to clipboard
A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript.
There is common code in each of the "to" methods. For instance ``` public toConstantValue(value: T): interfaces.BindingWhenOnSyntax { this._binding.type = BindingTypeEnum.ConstantValue; this._binding.cache = value; this._binding.dynamicValue = null; this._binding.implementationType = null;...
@notaphplover With respect to https://github.com/inversify/InversifyJS/pull/1132#discussion_r623367620 This is what I think the correct typing should be after #1132. Omitting unnecessary properties. ``` export interface Binding extends Clonable { serviceIdentifier: ServiceIdentifier; dynamicValue:...
I don't see a clear way to inject server level express middleware, if that middleware has HttpContext as dependency. ## Expected Behavior ``` const expressServer = new InversifyExpressServer(inversifyContainer, null, {...
I'm looking for best practices or recommendations for my usage of Inversify. I'm defining a few layers of packages that all need to share a container instance. Each layer provides...
https://github.com/inversify/InversifyJS/blob/65596eaa2915787d14f852992539a957acc23af0/src/planning/planner.ts#L116 ```typescript switch (bindings.length) { // ... case BindingCount.OnlyOneBindingAvailable: if (!target.isArray()) { return bindings; } case BindingCount.MultipleBindingsAvailable: default: if (!target.isArray()) { // ... } else { return bindings; } }...
As a user of the library I would expect that the child container will inherit the options of the parent container. Option " skipBaseClassChecks" in particular is not inherited from...
I have an issue resolving 3rd party class and the message I get is a bit cryptic. So I decorate PrismaClient with injectable and bind to the container ```typescript decorate(injectable(),...
Using inversify v5.0.5 and metro-bundler (running on react-native with babel) I get this warning. ``` [Fri Mar 19 2021 20:58:19.746] WARN Require cycle: node_modules/inversify/lib/syntax/binding_on_syntax.js -> node_modules/inversify/lib/syntax/binding_when_syntax.js -> node_modules/inversify/lib/syntax/binding_on_syntax.js Require cycles...
I want a Ninja per Weapon in every game board class. ```typescript @injectable() class Katana implements Weapon { public hit() { return "cut!"; } } @injectable() class Shuriken implements Weapon...
Suggested by @akosyakov in the chat: > ```ts class Foo { @inject(Bar) set bar(bar: Bar) { this.bar.onChanged(() => this.update()); } } ``` > I understood that i can do it...