我正在尝试重构自定义 api get,如下所示:
get( route: string, responseType: RespType = 'json', fullResponse: boolean = false, params = null): Observable<any> {
return this.invoke( 'GET', route, null, responseType, fullResponse, true, params);
}
对此:
@Injectable({
providedIn: 'root'
})
export class DocumentCorrespondenceService {
allCorrespondence: Observable<DossierEntry>;
correspondenceEntries: Observable <DossierEntry>;
attachmentEntries: Observable<DossierEntry>;
constructor(private http: HttpClient) { }
getDossierEntry( type: String = '' ): Observable<Array<DossierEntry>> {
const entryType = type === '' ? 'all' : 'type/' + type;
return this.http.get( '/api/patient/{patientUUID}/DossierEntry/' + entryType );
}
getDossierEntryFileData( entryID: number ): Observable<HttpResponse<Blob>> {
return this.get( '/api/patient/{patientUUID}/DossierEntry/' + entryID + '/fileData', 'pdf', true );
}
}
但我现在收到这样的错误:
Type 'Observable<Object>' is not assignable to type 'Observable<DossierEntry[]>'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
Type 'Object' is missing the following properties from type 'DossierEntry[]': length, pop, push, concat, and 26 more.ts(2322)
那我必须改变什么?
有只小跳蛙
相关分类