I am trying to create a generic wrapper around TestBed.createComponent, which takes a type argument and creates the component for that type. However, the TestBed.createComponent function takes an argument of type Type<T>. I'm unable to create a Type<T> from the passed in generic T argument.
export function createTestHarness<T>(): TestHarness<T> {
let component: T;
let fixture: ComponentFixture<T>;
fixture = TestBed.createComponent<T>(**PROBLEM AREA**);
component = fixture.componentInstance;
fixture.detectChanges();
return new TestHarness<T>(component, fixture);
}
Is there a way to derive a Type<T> from the type passed in?