ts-di-modules
v1.5.0
Published
Minimalist dependency injection framework for typescript. Create modules, and define services to use within its scope similar to the DI architecture in Angular.
Downloads
7
Readme
Overview
Minimalist dependency injection framework for typescript. Create modules and define providers (services, handlers etc) to use within the scope of a module. Also import modules and export providers to connect modules together - similar to the DI architecture in Angular.
Important to notice from v1.4.2
Removed possibility of importing and exporting modules as it only increases complexity and bugs. Keeping it simple and using a root module for providers now, so create providers in sub-folders as you like, and create i.e. an export file with the providers in an array. Use i.e. the spread operator to import them in the module. (see updated example here).
Example
https://gitlab.com/oleklokkhammer/ts-di-modules/ts-di-modules-example
Requirements
Typescript projects
This project requires the following tsconfig options to be set for typescript:
- "experimentalDecorators": true,
- "emitDecoratorMetadata": true,
React etc through babel plugin
- https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy