typedi
typedi copied to clipboard
Simple yet powerful dependency injection tool for JavaScript and TypeScript.
Hi, is it possible to check if a singleton of a constructable was already created? `has` will only check if the constructable was registered globally. This is useful if you...
**I was trying to...** Register a Token value that could be reused in all resolved instanced per call to `Container.get(MyService)` use case: a `correlation` or `commonId` UUID that's shared between...
### Description I have a base class that handles a lot of common logic that my sub classes use. The base class accepts a single dependency, and is only used...
I have A and B injecting each other: ```typescript import "reflect-metadata"; import { Container, Inject, Service } from "typedi"; @Service() class A { @Inject((type) => B) private b!: B; constructor()...
### Description Here is the error message ``` TS2769: No overload matches this call. The last overload gave the following error. Argument of type 'typeof IgpapiHttp' is not assignable to...
### Description This task aims at rethinking and rewriting how container inheritance and dependency lookup works between containers. This task should include rework or implementation of the following features -...
### Description Container.of used to accept instanceId of any. Now it only accepts string (see this commit: https://github.com/typestack/typedi/commit/511e37f29e7fce4759058cfc5d7acb297bf4a653). Shouldn't it also support Symbol or Token to prevent name clashes? ###...
### Description This issue describes a list of various updates to the documentation. #### General - [ ] explain that injection only happens when class created via `Container.get` - [...
There are some very common use-cases requiring asynchronous initialization of class instances, e.g. database connection on a repository. This PR enables this via opt-in non-breaking features, without having to do...
### Description It is often needed to pass one-time options to an instance as a temporary dependency. ### Proposed solution ```ts container.get(SomeClass, {providers: [{id: SomeToken, value: {option: 123}}]}) container.get(SomeClass, {providers:...