import type { AbstractConstructor, Constructor } from '../../types'; import { getServiceName, ServiceNameProp } from '../meta'; import type { RemoteService } from './types'; /** * create inject token for service */ export function RemoteServiceOf(base: Constructor | AbstractConstructor): Constructor> { const Base = base as Constructor; return class RemoteService extends Base { static [ServiceNameProp] = getServiceName(base); toString() { return `${RemoteService.name}(${RemoteService[ServiceNameProp]})`; } toJSON() { return this.toString(); } } as any; }