Я получаю сообщение об ошибке типа Expected 0 type arguments, but got 2
на updateRole()
из следующего кода
account-endpoint.service.ts
getRoleByRoleNameEndpoint<T>(roleName: string): Observable<T> {
let endpointUrl = `${this.roleByRoleNameUrl}/${roleName}`;
return this.http.get<T>(endpointUrl, this.getRequestHeaders()).pipe<T>(
catchError(error => {
return this.handleError(error, () => this.getRoleByRoleNameEndpoint(roleName));
}));
}
getUpdateRoleEndpoint<T>(roleObject: any, roleId: string): Observable<T> {
let endpointUrl = `${this.rolesUrl}/${roleId}`;
return this.http.put<T>(endpointUrl, JSON.stringify(roleObject), this.getRequestHeaders()).pipe<T>(
catchError(error => {
return this.handleError(error, () => this.getUpdateRoleEndpoint(roleObject, roleId));
}));
}
account.service.ts
private onRolesChanged(roles: Role[] | string[], op: RolesChangedOperation) {
this._rolesChanged.next({ roles: roles, operation: op });
}
updateRole(role: Role) {
if (role.id) {
return this.accountEndpoint.getUpdateRoleEndpoint(role, role.id).pipe(
tap(data => this.onRolesChanged([role], AccountService.roleModifiedOperation)));
} else {
return this.accountEndpoint.getRoleByRoleNameEndpoint<Role>(role.name).pipe<Role>(
mergeMap((foundRole: Role) => {
role.id = foundRole.id;
return this.accountEndpoint.getUpdateRoleEndpoint(role, role.id);
}),
tap(data => this.onRolesChanged([role], AccountService.roleModifiedOperation)));
}
}
Как исправить эту ошибку?