Skip to content

v1.3.0

Compare
Choose a tag to compare
@remojansen remojansen released this 02 Feb 14:51
· 1354 commits to master since this release

Injections without @Inject are not supported anymore (PR #64 Issues #56 and #62)

The Inject decorator can be applied to a class:

interface IKatana {
    power : number;
    hit() : boolean;
}

interface IShuriken {
    power : number;
    throw() : boolean;
}

@Inject("IKatana", "IShuriken")
class Warrior {

    private _katana : IKatana;
    private _shuriken : IShuriken;

    constructor(katana : IKatana, shuriken : IShuriken) {
        this._katana = katana;
        this._shuriken = shuriken;
    }
}

The following is not supported anymore:

class Warrior {

    private _katana : IKatana;
    private _shuriken : IShuriken;

    constructor(
        @Inject("IKatana") katana : IKatana, 
        @Inject("IShuriken") shuriken : IShuriken
    ) {
        this._katana = katana;
        this._shuriken = shuriken;
    }
}

Injections based on naming conventions are also not supported anymore:

class Warrior {

    private _katana : IKatana;
    private _shuriken : IShuriken;

    constructor(IKatana: IKatana, IShuriken: IShuriken) {
        this._katana = IKatana;
        this._shuriken = IShuriken;
    }
}