Trying to alter the Entity type, I am invoking a function that requires two parameters - one being the entity and the other a location. However, when trying to assign a Type for the first entity, it throws an error:
Error: Argument of type 'Node<EntityBasic>' is not compatible with parameter of type 'Node<AlertBasic>'.
Type 'EntityBasic' cannot be assigned to type 'AlertBasic'.
Property 'id' is optional in type 'EntityBasic' but mandatory in type 'AlertBasic'.
The function in question is as follows:
public async func() {
const entBasic: EntityBasic = this.getEntity(entity);
const NEO4J_TYPE = entType === 'alert' ? 'Alert' : 'Guide';
const entNode = await this.neo4jService.createOrUpdate<EntityBasic>(
NEO4J_TYPE,
entBasic.id,
entBasic,
);
if (NEO4J_TYPE === 'Alert')
await this.calendarEventsSyncService.handleEvents(entNode, location);
}
I need to change entNode from EntityBasic to AlertBasic.
I have tried the following:
if (NEO4J_TYPE === 'Alert')
await this.calendarEventsSyncService.handleEvents(entNode: AlertBasic, location);
But it returns an error
Expected 2 parameters instead of 3