I don't understand why the line this.claim = claim; has the error "Cannot convert type 'A' to type 'Claim'". I need to return an observable because this function is called in a resolver. I don't actually need to return the claim itself, I just need to set the property on ClaimStoreService, but I couldn't figure out how to return an empty or void observable.
export class ClaimStoreService {
constructor(private readonly claimService: ClaimService) { }
claim: Claim;
getClaim(guid: string): Observable<Claim> {
return this.claimService.get(guid).pipe(
take(1),
mergeMap(claim => {
// Cannot convert type 'A' to type 'Claim'
this.claim = claim;
return of(claim);
}));
}
}
any. However, have you tried usingmergeMap((claim: any) =>ormergeMap((claim:Claim) =>orreturn this.claimService.get<Claim>(guid)?