import { Injectable, Type } from '@angular/core'; import { Map } from '../utils/js-utils'; // tslint:disable-next-line: no-any const COMPONENT_MAP: Map> = {}; // tslint:disable-next-line: no-any export function register(dataType: Type) { // tslint:disable-next-line: no-any return (cls: Type) => { COMPONENT_MAP[dataType.name] = cls; }; } @Injectable({ providedIn: 'root', }) export class ComponentRegisterService { // tslint:disable-next-line: no-any getComponent(dataType: Type) { return COMPONENT_MAP[dataType.name]; } }