모두 tsconfig.json
를 설정하여야 합니다.
{
"compilerOptions": {
...
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
...
}
}
그리고, 모두 reflect-metadata
package에 의존적입니다.
import { autoInjectable, inject, injectable } from "tsyringe";
import "reflect-metadata"; // index.ts
import { container } from 'tsyringe';
import { Service } from 'typedi';
import "reflect-metadata"; // app.ts or loader.ts
import { Container } from 'typedi';
https://docs.typestack.community/typedi/02-basic-usage-guide#registering-dependencies
There are three ways to register your dependencies:
@Service()
decoratorContainer.set()
Token()
import { injectable, inject } from "inversify";
import "reflect-metadata";
import { Container } from "inversify";
참고)