【发布时间】:2020-10-06 10:57:52
【问题描述】:
import { HttpObserve } from '@angular/common/http/src/client';
import { HttpParams, HttpHeaders } from '@angular/common/http';
type responseType = 'arraybuffer' | 'blob' | 'json' | 'text';
export interface RequestOptions {
body?: any;
headers?: HttpHeaders;
params?: HttpParams;
observe?: HttpObserve;
reportProgress?: boolean;
responseType?: responseType;
withCredentials?: boolean;
}
升级到 Angular 8 后,上面的代码抛出了下面提到的错误,有什么帮助吗?
error TS2307: Cannot find module '@angular/common/http/src/client'.
【问题讨论】:
-
参见例如github.com/angular/angular/issues/18146。从外观上看,它被 github.com/angular/angular/pull/18417 内联。为什么需要访问这些类型?
-
你为什么接受这个答案?你已经在使用@angular/common/http。
标签: angular interface client httpresponse observers