Answer the question
In order to leave comments, you need to log in
How to make the IDE understand the contents of the DI container?
I am using the Awilix library to create a DI container. The content of the DI.ts file is:
import * as _ from 'lodash';
import {ModuleDescriptor} from "awilix";
const awilix = require('awilix');
const container = awilix.createContainer();
// Загружаем в контейнер сервисы (службы) реализующие бизнес логику
container.loadModules([
[
__dirname + '/../services/*.ts',
{
register: awilix.asClass,
lifetime: awilix.Lifetime.SINGLETON,
}
]
], {
formatName: (name:string, descriptor:ModuleDescriptor) => {
return _.lowerFirst(name) + 'Service';
},
resolverOptions: {
lifetime: awilix.Lifetime.SINGLETON,
register: awilix.asClass,
}
});
export default container.cradle;
import Statement from "../services/Statement";
import DI from "../System/DI";
/** @type Statement */
let service = DI.statementService;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question