I am attempting to achieve the following:
export interface ApiCallOptions {
abc: string,
xyz: number
}
makeRequest (options: ApiCallOptions) {
return this.http.get('/some/path/to/endpoint', { params: options });
}
However, I encounter an error stating that ApiCallOptions is not a HttpParams object... I attempted casting options as HttpParams, but it still fails...
Therefore, I proceeded with:
const params = new HttpParams({ fromObject: options });
return this.http.get('/some/path/to/endpoint', { params: params });
Resulting in:
The expected type comes from property 'fromObject' which is declared here on type 'HttpParamsOptions'
What mistake am I making here?