I'm attempting to develop a universal wrapper for TestBed.createComponent
, where it takes a type argument and generates the component based on that type. Unfortunately, the TestBed.createComponent
function necessitates an argument of type Type<T>
. I'm encountering difficulties in forming a Type<T>
from the given generic T parameter.
export function createTestHarness<T>(): TestHarness<T> {
let component: T;
let fixture: ComponentFixture<T>;
fixture = TestBed.createComponent<T>(**ISSUE AREA**);
component = fixture.componentInstance;
fixture.detectChanges();
return new TestHarness<T>(component, fixture);
}
Is there any method to deduce a Type<T>
from the specified type?