@bviale/typescript-di
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Dependency Injection decorators for Typescript

A very light library to handle dependency injection with Typescript decorators using the Angular @Service way.

Resolves the dependencies between services and allow the decorated services to be retrieved using the ServiceLocator singleton.

Can be used in all kinds of Typescript projects such as React.

Usage

@Service
class LoginService {

}

@Service
class AuthenticationService {
    // Will be automatically injected
    constructor (private loginService: LoginService) { }
}

const instance = ServiceLocator.instance.getService(AuthenticationService) as AuthenticationService;

Package Sidebar

Install

npm i @bviale/typescript-di

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

8.63 kB

Total Files

9

Last publish

Collaborators

  • bviale