tsyringe doesn't work properly does anyone know why

23 Views Asked by At

I'm trying to do some projects with tsyringe, but I'm having some problems. Who can help me?

import "reflect-metadata";
import { container, injectable } from "tsyringe";

@injectable()
class B{
    constructor(){}
}

@injectable()
class C{
    constructor(b: B){}
}

container.resolve(C); // Uncaught Error: TypeInfo not known for "C"

It's working fine here. Why is my code not working

This works well

@injectable()
class B{
    constructor(){}
}

@injectable()
class C{
    constructor(@inject(B) b: B){}
}

container.resolve(C); // in working order
0

There are 0 best solutions below