typedi
typedi copied to clipboard
Simple yet powerful dependency injection tool for JavaScript and TypeScript.
## Description ## Checklist - [x] the pull request title describes what this PR does (not a vague title like `Update index.md`) - [x] the pull request targets the *default*...
**The problem:** I have 3 services: **ApiHelper** ```typescript @Service() export class ApiHelper { // contains only methods, none of services are injected } ``` **LoginService** ```typescript @Service() export class SecurityService...
```js const AlanService = require('../../services/alan/alan.service'); const Container = require('typedi').Container; exports.readAll = async (req, res, next) => { try { const alanService = Container.get(AlanService); const result = await alanService.alan(); responseJson(req, res,...
### Description please just see the code below. **Minimal code-snippet showcasing the problem** ```ts it('should inject the right value in subclass constructor params', function () { function CustomInject(value: any) {...
I am creating my custom decorator InjectConnection: ```ts export default function InjectConnection(dbName: string) { return (object: any, propertyName: string, index: number) => { Container.registerHandler({ object, propertyName, index, value: () =>...
The only activity I see is from a bot. There are a lot of unanswered questions. Any status update would be great.
### Description I started using the `eager` flag on some of my `@Services` that I would expect to be started as soon as they are registered (Database, Logger, Mailer, etc)...
### Description ```ts const token = new Token("MY TOKEN"); container.set(token, 123); // no warning ``` ### Proposed solution If it's a token infer the type, same for: ```ts container.set({ id:...
Hello! Consider a case where you have an asynchronous factory function: for example you need to make a request or read some file from the filesystem before creating an instance...
### Description I am having an issue with class inheritance and I am not sure if it is a bug or something that I misunderstand. The situation goes like so:...