我正在嘗試重構(gòu)自定義 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); }對(duì)此:@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 );}}但我現(xiàn)在收到這樣的錯(cuò)誤: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)那我必須改變什么?
可觀察錯(cuò)誤,嘗試使用get方法
眼眸繁星
2021-10-21 17:18:31