Problem using TSyringe

I am trying to use TSyringe for dependency injection, only problem is it doesn't work for my main class. All of my other autoinjectables work just fine, I just need to pass them to my App class. When I try to resolve it using container.resolve(App) I get the following error:
474 | var paramInfo = typeInfo.get(ctor);
475 | if (!paramInfo || paramInfo.length === 0) {
476 | if (ctor.length === 0) {
477 | return new ctor();
478 | } else {
479 | throw new Error('TypeInfo not known for "' + ctor.name + '"');
^
error: TypeInfo not known for "App"
474 | var paramInfo = typeInfo.get(ctor);
475 | if (!paramInfo || paramInfo.length === 0) {
476 | if (ctor.length === 0) {
477 | return new ctor();
478 | } else {
479 | throw new Error('TypeInfo not known for "' + ctor.name + '"');
^
error: TypeInfo not known for "App"
Tried using container.register<App>("App", { useClass: App }); just in case, but the error persisted. After some debugging it seems to be failing to inject the dependencies into said class. If I remove everything from the constructor the error goes away. Literally any parameter specified in the constructor causes an error, even without any decorators above the class or the @inject decorator. No clue what else it could be
1 Reply
Turbo 気
Turbo 気OP2y ago
bump
Want results from more Discord servers?
Add your server