You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

typedi

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typedi - npm Package Compare versions

Comparing version

to
0.4.2

3

Container.js

@@ -181,2 +181,3 @@ "use strict";

exports.Container = Container;
//# sourceMappingURL=Container.js.map
//# sourceMappingURL=Container.js.map

@@ -62,2 +62,3 @@ "use strict";

exports.Require = Require;
//# sourceMappingURL=decorators.js.map
//# sourceMappingURL=decorators.js.map
"use strict";
//# sourceMappingURL=Handlers.js.map
//# sourceMappingURL=Handlers.js.map

@@ -8,2 +8,3 @@ "use strict";

__export(require("./decorators"));
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map
{
"name": "typedi",
"version": "0.4.1",
"version": "0.4.2",
"description": "Dependency injection for Typescript",

@@ -26,7 +26,7 @@ "license": "Apache-2.0",

],
"dependencies": {
},
"dependencies": {},
"devDependencies": {
"chai": "^3.4.1",
"del": "^2.2.0",
"del": "^2.2.1",
"es6-shim": "^0.35.1",
"gulp": "^3.9.1",

@@ -36,18 +36,18 @@ "gulp-mocha": "^2.2.0",

"gulp-shell": "^0.5.1",
"gulp-tslint": "^4.3.3",
"gulpclass": "0.1.0",
"mocha": "^2.3.2",
"sinon": "^1.17.2",
"gulp-sourcemaps": "^1.6.0",
"gulp-tslint": "^6.0.1",
"gulp-typescript": "^2.13.6",
"gulpclass": "^0.1.1",
"mocha": "^2.5.3",
"reflect-metadata": "^0.1.3",
"sinon": "^1.17.4",
"sinon-chai": "^2.8.0",
"tslint": "^3.5.0",
"tslint": "^3.13.0",
"tslint-stylish": "^2.1.0-beta",
"typescript": "^1.8.7",
"typings": "^0.7.7",
"es6-shim": "^0.35.0",
"reflect-metadata": "^0.1.3"
"typescript": "^1.8.10",
"typings": "^1.3.1"
},
"scripts": {
"postversion": "./node_modules/.bin/gulp package",
"test": "./node_modules/.bin/gulp tests"
"test": "gulp tests"
}
}

@@ -232,2 +232,66 @@ # TypeDI

### Problem with circular references
There is a known issue in language that it can't handle circular references. For example:
```javascript
// Car.ts
@Service()
export class Car {
@Inject()
engine: Engine;
}
// Engine.ts
@Service()
export class Engine {
@Inject()
car: Car;
}
```
This code will not work, because Engine has a reference to Car, and Car has a reference to Engine.
One of them will be undefined and it will cause an errors. To fix them you need to specify a type in a function like this:
```javascript
// Car.ts
@Service()
export class Car {
@Inject(type => Engine)
engine: Engine;
}
// Engine.ts
@Service()
export class Engine {
@Inject(type => Car)
car: Car;
}
```
And that's all. Same for injects for constructor injection.
### Inherited injections
Inherited injections are supported as well. In order to use them you must mark inherited class as a @Service.
For example:
```javascript
// Car.ts
@Service()
export abstract class Car {
@Inject(type => Engine)
engine: Engine;
}
// Engine.ts
@Service()
export class Bus extends Car {
// you can call this.engine in this class
}
```
## Samples

@@ -234,0 +298,0 @@

{
"ambientDevDependencies": {
"globalDevDependencies": {
"Q": "github:DefinitelyTyped/DefinitelyTyped/q/Q.d.ts#a6ff9f6e195a334afd89e4b721d05e9520eee4c0",

@@ -12,3 +12,3 @@ "assertion-error": "github:DefinitelyTyped/DefinitelyTyped/assertion-error/assertion-error.d.ts#7a3ca1f0b8a0960af9fc1838f3234cc9d6ce0645",

},
"ambientDependencies": {
"globalDependencies": {
"es6-shim": "registry:dt/es6-shim#0.31.2+20160215162030",

@@ -15,0 +15,0 @@ "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#a6ff9f6e195a334afd89e4b721d05e9520eee4c0"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet