
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
TypedIOC is the IOC Container for Typescript
npm install typedioc --save
Add experimentalDecorators": true and "emitDecoratorMetadata": true to your compilerOptions
import {Container, Lifetime,resolvable} from "typedioc";
@resolvable()
class Car{
public engine: Engine;
constructor(engine: Engine){
this.engine=engine;
}
}
var container: Container = new Container();
var car: Car = container.resolve<Car>(Car);
import {Container, Lifetime,resolvable} from "typedioc";
@resolvable()
class Vehicle{
public serialNumber: number;
constructor(){
this.serialNumber=Math.random();
}
}
@resolvable()
class Car extends Vehicle{
public engine: Engine;
constructor(engine: Engine){
super();
this.engine=engine;
}
}
//Option 1: Singleton, each resolved Vehicle will point to the same instance
var container: Container = new Container();
container.registerType(Vehicle,Car,Lifetime.Singleton);
var vehicle1: Vehicle = container.resolve<Vehicle>(Vehicle);//vehicle1 is a instance of Car
var vehicle2: Vehicle = container.resolve<Vehicle>(Vehicle);
//vehicle1.serialNumber == vehicle2.serialNumber
//Option 2: transient, each resolved Vehicle will be a new instance
var container2: Container = new Container();
container2.registerType(Vehicle,Car,Lifetime.Transient);
var vehicle3: Vehicle = container2.resolve<Vehicle>(Vehicle);
var vehicle4: Vehicle = container2.resolve<Vehicle>(Vehicle);
//vehicle3.serialNumber != vehicle4.serialNumber
import {Container, Lifetime,resolvable} from "typedioc";
@resolvable()
class Vehicle{
public serialNumber: number;
constructor(){
this.serialNumber=Math.random();
}
}
@resolvable()
class Car extends Vehicle{
public engine: Engine;
constructor(engine: Engine){
super();
this.engine=engine;
}
}
var container: Container = new Container();
var carInstance: Car = new Car();
carInstance.serialNumber=1234;
container.registerInstance(Vehicle,carInstance);
var resolvedVehicle: Vehicle = container.resolve<Vehicle>(Vehicle);
FAQs
TypedIOC is the IOC Container for Typescript
We found that typedioc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.