In an attempt to enhance the convenience of my application class, I decided to create a Sub-class EntityServices based on the NGRX/data documentation which can be found here.
Despite following the provided example, it appears that it does not function properly with the latest version of ngrx/data 8.5.2. Here is what the example looks like:
@Injectable()
export class AppEntityServices extends EntityServicesBase {
constructor(
public readonly store: Store<EntityCache>,
public readonly entityCollectionServiceFactory: EntityCollectionServiceFactory,
// Inject custom services, register them with the EntityServices, and expose in API.
public readonly heroesService: HeroesService,
public readonly villainsService: VillainsService
) {
super(store, entityCollectionServiceFactory);
this.registerEntityCollectionServices([heroesService, villainsService]);
}
}
Upon implementing the example into my codebase, I encountered a TypeScript error:
Error: (parameter) entityCollectionServiceFactory: EntityCollectionServiceFactory Expected 1 arguments, but got 2. ts(2554)
This error arises when calling the parent's constructor super(...)
. It seems that the constructor of EntityServicesBase
only accepts one argument of type EntityServicesElements
. How can I then successfully create my own custom AppEntityService? I have yet to find a functioning example.