Cannot get an instance from the inversify container when I try to execute getNamed(). The container is well defined, typescript does not complain, I can see that the type of the import is "Container"; however, in the runtime container is undefined.
I'm binding UserRepo class as shown below, and exporting the container as "Registry"
container.bind<Repository>('Repository').to(UserRepo).inSingletonScope().whenTargetNamed('User');
.
.
.
export { container as Registry };
import { Registry } from '../registry';
import { UserRepo } from '../repositories/userRepository';
const userRepo: UserRepo = Registry.getNamed('Repository', 'User'); // throws an error
The error I get is
uncaughtException: Cannot read property 'getNamed' of undefined
TypeError: Cannot read property 'getNamed' of undefined
I am executing the same code, for a different class, in the root of my application, and it works. It would be great if anyone can point out where I am making a mistake.