Thursday, 1 June 2017

Missing @inject annotation, which isn't missing in inversify with an extending class

I'm having a problem which seems a bit hard to put into a title, which is why you've gotten this beast of a title.

I get an error stating: Error: Missing required @inject or @multiInject annotation in: argument 0 in class SceneRepository..
This seems simple enough, I should add an @inject annotation to my first argument. This is my constructor though:

export class SceneRepository extends BaseRepository<IScene> {
  constructor(@inject(SceneSchema) private sceneSchema: SceneSchema) {
    super(sceneSchema.schema);
  }
}

And for the sake of being complete, this is what my BaseRepository looks like:

export class BaseRepository<T extends Document> implements IWrite<T>, IRead<T>{
  constructor(private _model: Model<Document>) {

  }
  ...
}

Model<Document> Comes from a third party library (mongoose).

I have no clue to what I'm doing wrong here, so if you could nudge me in the correct direction, it would be greatly appreciated.



via Pjetr

No comments:

Post a Comment