Is it possible to inject classes that you can't edit? It seems Inversify is heavily dependent on annotations/decorators but is there another way?
Asked
Active
Viewed 1,166 times
1 Answers
1
From the inversify wiki:
In some cases you may get errors about missing annotations classes provided by a third party modul like:
Error: Missing required @injectable annotation in: SamuraiMaster
You can overcome this problem using the decorate function:
import { decorate, injectable } from "inversify"; import SomeClass from "some-module"; decorate(injectable(), SomeClass); return SomeClass;
Check out the JS example page on the wiki for more info.
You can also check out the inversify-vanillajs-helpers project.

Remo H. Jansen
- 23,172
- 11
- 70
- 93
-
1Thanks! I must have missed that. – Cristian Vrabie Jan 28 '17 at 22:08