0

I want to bind an interface that has a type parameter but I am don't how it's done.

Interface

...
export interface ITestHelper<Entity extends ObjectLiteral> {
  doSomething(builder: SelectQueryBuilder<Entity>,
    pagination: IPaginationParams): SelectQueryBuilder<Entity>;
}
export const TTestHelper = Symbol.for('ITestHelper');

ContainerModule I have tried binding like below but there's an error - Generic type 'ITestHelper' requires 1 type argument(s)

...
export const TestContainerModule = new ContainerModule((bind: interfaces.Bind) => {
    bind<ITestHelper>(TTestHelper)
    .to(TestHelper)
    .inSingletonScope();
});
Emz
  • 475
  • 1
  • 7
  • 16

1 Answers1

0

I think I got it I updated the binding to be

...
export const TestContainerModule = new ContainerModule((bind: interfaces.Bind) => {
    bind<ITestHelper<ObjectLiteral>>(TTestHelper)
    .to(TestHelper)
    .inSingletonScope();
});
Emz
  • 475
  • 1
  • 7
  • 16