You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the problem is, that the generic information does not exist at runtime, so in your js the entity information is missing and only the repository part remains. Repository refers to the class Repository from typeorm (that also exists in js) whereas Repository<Entity> refers to the type - a construct that only exists in typescript.
What you need is a unique repository only for one entity that exists in JS and can therefore be injected anywhere.
We also struggle with integrating typeorm with typescript-ioc but found no good solution yet.
What works is the approach explained above, to have unique repositories. Something like this (note DatabaseService is a wrapper we wrote around typeorm that handles the connection):
I m trying to register a generic type
Container.bind(Repository<Entity>)
repository is an abstract class and holds multiple implementations for each entity.
I got an error
I tried factory but still cant do it
or there a way to do that ?
The text was updated successfully, but these errors were encountered: